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 — freeGoogle 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:
| IMPORTHTML | SheetScraper | |
|---|---|---|
| Cost | Free, built into Sheets | Free up to 50 rows per scan; Pro removes the limit |
| Finding the table | Count and try the table number | Auto-Detect lists the tables with a preview |
| Live link to the page | Yes | No, one-time copy (Watch this page is coming in v1.2, in review) |
| Signed-in or script-built pages | Often fails | Reads what your open tab shows |
| Output | Cells in a Sheet | Copy 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.
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.
Select the imported range, copy it, then use Edit > Paste special > Values only. The cells become plain values that no longer follow the page.
Yes. Use "list" instead of "table" as the second argument and give the list number.
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.
I built SheetScraper because copying tables by hand wastes an afternoon. Install it, open a Wikipedia article, click Auto-Detect.
Add to Chrome — free