← Blog

How to Use the Wikipedia Pageviews API in Google Sheets

The Wikipedia pageviews API is free and needs no key. Here's how the URL works, a small Apps Script function that pulls monthly views into Google Sheets, and a no-code template if you'd rather skip it.

Wikipedia has a free API that tells you how many people read any article, every month, back to 2015. No key, no signup, no rate plan. Hardly anyone uses it.

This post shows how the API works and how to get it into Google Sheets two ways: a small Apps Script function you can paste in yourself, or my free template, the Wikipedia Trends Tracker, which already does it and draws the chart.

The short answer

Call https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia/all-access/user/ARTICLE/monthly/START/END with the article title and two dates. It returns JSON with one item per month. Google Sheets can't read that JSON with a plain formula, so use a short Apps Script custom function, or a template that has one built in.

How the API URL works

Here's a real request for the Pickleball article, monthly, October 2021 through September 2026:

https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/en.wikipedia/all-access/user/Pickleball/monthly/20211001/20260930

Each part of the path means something:

  • en.wikipedia: the project. Use de.wikipedia, fr.wikipedia, and so on for other languages.
  • all-access: desktop and mobile together. You can also ask for desktop, mobile-web, or mobile-app.
  • user: human readers only. all-agents includes known bots and crawlers. Use user.
  • Pickleball: the article title, exactly as it appears after /wiki/ in the address bar, with underscores for spaces.
  • monthly: or daily.
  • 20211001/20260930: start and end dates as YYYYMMDD.

Open that link in a browser and you'll see a list of months, each with a timestamp and a views number.

Why IMPORTDATA and IMPORTXML don't work here

The API returns JSON. IMPORTDATA expects CSV or TSV, and IMPORTXML expects HTML or XML, so neither can pull the views out cleanly. You need a little script, or a template that already has one.

Option 1: a custom function in Apps Script

Here's the whole function:

function WIKIVIEWS(article, start, end) {
  var url = 'https://wikimedia.org/api/rest_v1/metrics/pageviews/per-article/' +
    'en.wikipedia/all-access/user/' + encodeURIComponent(article) +
    '/monthly/' + start + '/' + end;
  var res = UrlFetchApp.fetch(url, { muteHttpExceptions: true });
  if (res.getResponseCode() !== 200) return 'No data';
  var items = JSON.parse(res.getContentText()).items;
  return items.map(function (i) {
    return [i.timestamp.slice(0, 4) + '-' + i.timestamp.slice(4, 6), i.views];
  });
}
  1. In your sheet, open Extensions, then Apps Script.
  2. Paste the function above and save.
  3. Back in the sheet, type =WIKIVIEWS("Pickleball", "20211001", "20260930") in an empty cell.
  4. Give it a few seconds. You'll get two columns: month and views.
  5. Select both columns and insert a line chart.

Two things trip people up. Titles with special characters, like Tesla,_Inc., need encoding, which encodeURIComponent handles. And if an article was renamed, its history is split across the old and new titles, so you'll need to call both and add them together.

Option 2: the no-code template

If you don't want to touch Apps Script, the Wikipedia Trends Tracker is a free Google Sheet with the API already wired up.

  1. Get the template and make a copy.
  2. On the Controls tab, paste a Wikipedia link or just the title into Page 1 and another into Page 2. No formatting needed.
  3. Set Range to All time and Daily or monthly to Monthly, then click Fetch views + chart.
  4. You get one chart and a winner table. Add up to three more pages for more lines.

A real example: Tesla vs BYD

I ran this pair through the API (English Wikipedia, human readers). The Tesla, Inc. article went from about 3.55 million views in 2022 to about 2.47 million in 2025. The BYD Auto article went from about 388,000 to about 1.40 million over the same years.

Tesla still gets more readers. But BYD's line is the one that more than tripled. That's the kind of thing you only see with real counts over several years. The live chart is on the Tesla vs BYD page.

FAQ

Do I need an API key for the Wikipedia pageviews API?

No. It's public and free. Wikimedia asks that you send a descriptive user agent and keep request rates reasonable. If you hammer it, you'll get a "too many requests" error.

How far back does the data go?

July 2015 for the pageviews API.

Why does the last month look so low?

The current month is still being counted. Leave it out, or treat it as partial.

Can I pull daily views instead?

Yes. Change monthly to daily in the URL. Expect a lot more rows and a much noisier chart.

Rather skip the script? Get the free Wikipedia Trends Tracker. The API is already connected. Paste two links and you're done.

More on tracking trends

Ads keep the free stuff free. Members browse ad-free — log in or see pricing.
Big Year 2027 calendar: the whole year on one Google Sheet

Free 2027 calendar.Plan all of 2027 on one Google Sheet, free.

Copy it to your Google Drive.

Free. No password, no card. The sheet link shows up right here.