Guide · Wikipedia · Google Sheets

Wikipedia table to Google Sheets: IMPORTHTML and a one-click option

IMPORTHTML is the standard answer, and it works until it does not. Here is the exact formula, why it sometimes fails, and a faster route when you just want the table in your sheet.

Add to Chrome — free
Free: every export, up to 50 rows per scan. Pro: unlimited rows and webhook push, $30 once or $9/month, taxes included.

The free way: the IMPORTHTML formula

Google Sheets has a built-in function that reads tables from a web page. Click an empty cell (A1 is fine) and type:

=IMPORTHTML("https://en.wikipedia.org/wiki/List_of_largest_cities", "table", 1)

The three parts are the page address, the word "table" (use "list" for bullet lists) and the position of the table on the page. Press Enter and the table fills in below and to the right. If you see the wrong table, change 1 to 2, 3 and so on until the right one appears.

Two tips. Keep the cells below and to the right of your formula empty, or Sheets shows a #REF! error because it has no room to fill the result. And if you want a fixed copy that never changes, select the result, copy it, then use Edit > Paste special > Values only.

Where IMPORTHTML falls short:

The one-click way with SheetScraper

  1. Open the Wikipedia article in Chrome and click the SheetScraper icon.
  2. Click Auto-Detect Table and pick the table you want from the side panel list.
  3. Check the preview and tidy columns in the column editor if you like.
  4. Click Copy to Sheets.
  5. Open Google Sheets, click cell A1 and press Ctrl+V. Each value lands in its own column. Or download the CSV and use File > Import.
SheetScraper detecting an encyclopedia-style table of planets and copying it out of the page
Recorded with SheetScraper v1.0.3 on a demo article styled like an encyclopedia page, with sample figures.
Now live in v1.1: native Excel (.xlsx) export, "Collect pages" (clicks Next or scrolls for you, up to 50 pages, merged into one table) and a column editor to rename, hide and reorder columns. Coming in v1.2 (in review): Watch this page, which re-checks a page and tells you when a table changes.

Which one should you use?

IMPORTHTMLSheetScraper
CostFree, built into SheetsFree up to 50 rows per scan; Pro removes the limit
Finding the tableCount and try the table numberAuto-Detect lists the tables with a preview
Live link to the pageYesNo, one-time copy (Watch this page is coming in v1.2, in review)
Signed-in or script-built pagesOften failsReads what your open tab shows
OutputCells in a SheetCopy to Sheets, Excel (.xlsx), CSV or JSON

Use IMPORTHTML when you want one known table that updates itself. Use SheetScraper when you want to see the table before you copy it, take one of many quickly, merge a list that runs over several pages with Collect pages, or copy from a site where the formula returns an error. If you also want the Excel version, see Wikipedia table to Excel. Wikipedia text is shared under the CC BY-SA licence, so credit Wikipedia and link to the article if you publish the data.

Questions

Why does IMPORTHTML say "imported content is empty"?

The page may build its table with JavaScript, may need a login, may block automated requests, or the table number you gave does not exist. Try a different number first. If it still fails, copy the table from your open tab with a tool that reads the page as you see it.

How do I stop the data from changing?

Select the imported range, copy it, then use Edit > Paste special > Values only. The cells become plain values that no longer follow the page.

Can IMPORTHTML import a list instead of a table?

Yes. Use "list" instead of "table" as the second argument and give the list number.

Does SheetScraper cost anything?

The free plan covers every export up to 50 rows per scan. Pro removes the row limit and adds webhook push: $30 once for lifetime, or $9 per month, taxes included.

Try it on your own page

I built SheetScraper because copying tables by hand wastes an afternoon. Install it, open a Wikipedia article, click Auto-Detect.

Add to Chrome — free
Free: every export, up to 50 rows per scan. Pro: unlimited rows and webhook push, $30 once or $9/month, taxes included.

More guides