To pull data from the Wikipedia API to Google Sheets easily and without writing any code, first install and open the Apipheny Google Sheets add-on.
Apipheny is a no-code API integrator for Google Sheets that you can use to make unlimited API requests, connect to unlimited APIs (including the Wikipedia API), save API requests, schedule API requests, and more. Click here if you want to learn more about Apipheny.
1. Install Apipheny by clicking the Install button on this page.
2. After you’ve installed Apipheny, open a Google Sheet and then click on Add-Ons in the top menu. In the add-ons menu, you should see Apipheny.
Then click Import API to open the Apipheny sidebar in your Google Sheets.
The API:Tokens module provides tokens required by data-modifying actions, such as logging, editing or moving a page, as well as watching or patrolling changes. For each action, you will need a specific type of token.
For example, if you want to login to a wiki site via the Action API, you would need a token of type “login” to proceed.
To obtain a login token, write the following command in your terminal window and then press the Enter key:
curl -G "https://en.wikipedia.org/w/api.php?action=query&meta=tokens&format=json&type=login"
The type parameter value depends on the type of token you want to obtain. It could be createaccount, csrf, deleteglobalaccount, login, patrol, rollback, setglobalaccountstatus, userrights or watch. The default value is csrf.
If you want to retrieve two tokens simultaneously, then the type parameter will have the two values separated by the pipe symbol (“|”):
In this section, I’ll show you how to browse the Wikipedia API documentation to find an API URL that retrieves the information you need. If you already know your API URL, or you want to use the same example URL as us, just skip to Step 4.
First, open the Wikipedia API documentation page: https://www.mediawiki.org/wiki/API:Main_page
The menu on the right contains the list of links for the available API endpoints, grouped by their roles:
If you click on an API endpoint, then that endpoint’s page will open, containing its description and documentation.
All API calls to Wikipedia should be made to the http://en.wikipedia.org/w/api.php base domain.
Wikipedia API base domain/root URL:
An example endpoint is Search for a language:
The documentation for each endpoint contains the HTTP method used (eg. GET), a description of the endpoint’s purpose, a list of its actions, parameters, possible errors and relevant usage examples:
Go back to your Google Sheet and make sure that the Apipheny add-on is open with the “Import” tab open.
Then enter these details into the add-on:
Method: At the top of the Apipheny sidebar, select the HTTP method (GET or POST) required by your API endpoint. For this example, we are using the GET method.
API URL: In Step 3, we explained how you can find the Wikipedia API endpoint that you need. Now copy the complete API URL and endpoint into the Apipheny add-on, where it says API URL Path, followed by any GET parameters required for your query.
For this example, we are using the Search for a title or a text endpoint, to obtain a title or a text in a wiki:
If you want to use this same example URL, just copy and paste it into Apipheny.
Headers aren’t required for this API request.
Your last step is to click the Run button at the bottom of the Apipheny add-on and then wait for the Wikipedia API data to be pulled in to your Google spreadsheet:
After making a successful request to the Wikipedia API, try querying a different endpoint, or try using one of the more advanced features in the Apipheny add-on.