Import Wikipedia Data to Google Sheets – Step by Step Guide

Import Wikipedia Data to Google Sheets – Step by Step Guide

Last Updated On June 03, 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.

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

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
  7. 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. (The article Create API Request Based on a Cell describes how you can point to a cell to automatically change the date in the URL.)
    wikipedia-img4

Following the above steps, you will now be able to import data from the Wikipedia API directly into Google Sheets.

Comments:0

Leave a Reply

Your email address will not be published.