Import Wikipedia Data to Google Sheets

Import Wikipedia Data to Google Sheets

Last Updated On August 16, 2019
You are here:
< Back

In this guide, we’ll show how to pull data from Wikipedia directly into Google Sheets, using the free API Connector add-on.

PART 1: CREATE YOUR API REQUEST URL

We’ll first follow the Wikimedia REST API documentation to pull in information about a random Wikipedia article, then show how to extend this to other API requests.

  • Base URL: https://en.wikipedia.org/api/rest_v1
  • Endpoint: /page/random/summary

Putting it together, we get the full API Request URL:
https://en.wikipedia.org/api/rest_v1/page/random/summary

PART 2: ENTER YOUR VALUES INTO API CONNECTOR

We can now enter our URL into API Connector and start importing Wikipedia data into Google Sheets.

  1. Open up Google Sheets and click Add-ons > API Connector > Create New API Request.
  2. In the Create Request interface, enter the Request URL we just created
    wikipedia-img1
  3. Under Headers, enter a key-value pair like this:
    User-Agent {your contact info}

    While this request will work without including a header, Wikipedia’s global API rules request that you set a unique User-Agent that allows them to contact you quickly. You may use an Email address or the URL to a contact page, like this:
    wikipedia-img2

  4. Create a new tab. You can call it whatever you like, but here we’ll call it ‘Wiki Random’. While still in that tab, click ‘Set’ to use that tab as your data destination.
  5. Name your request. Again we’ll call it ‘Wiki Random’
  6. Click Run and a moment later you’ll see information about a random article populate your Google Sheet:
    wikipedia-img3

PART 3: NOTES AND EXPANSIONS

  1. Experiment with endpoints as described in the documentation to see other types of Wikipedia responses. For example, you can change the API URL path to https://en.wikipedia.org/api/rest_v1/feed/onthisday/births/06/02 to see a list of births on a specific day.
    wikipedia-img4
  2. The article Create API Request Based on a Cell describes how you can point to a cell to dynamically change the date or endpoint in the URL.

Comments:0

Leave a Reply

Your email address will not be published.