Guide
How to copy a Wikipedia table into Excel or Google Sheets
Wikipedia is full of useful tables: population figures, election results, sports records, product lists. Copying one looks simple until the numbers arrive with [1] stuck to them, merged cells push columns out of line, and Excel won't add anything up. Here are three ways to get a clean copy.
Method 1: Google Sheets with IMPORTHTML
Google Sheets can read a Wikipedia table straight from its address. In an empty cell, type:
=IMPORTHTML("https://en.wikipedia.org/wiki/List_of_countries_by_population", "table", 1)
- Replace the address with the page you want.
- The last number picks the table:
1is the first table on the page,2the second, and so on. Infoboxes and navigation boxes count as tables too, so if you get the wrong one, try the next number. - Depending on your spreadsheet settings, the separator between the arguments is a semicolon instead of a comma.
The result stays linked to the page and updates when the page changes. That's handy for a live list and annoying when someone edits the article and your columns move. To freeze it, copy the range and use Edit > Paste special > Values only. More options in how to import a table from a website into Google Sheets.
Method 2: Excel with Power Query
- In Excel, go to Data > From Web.
- Paste the Wikipedia address and click OK.
- The Navigator shows every table Excel found on the page, numbered. Click through them until the preview shows the right one.
- Click Transform Data to fix headers and column types, or Load to put it in a sheet as is.
In the Power Query editor you can remove footnote markers with Transform > Replace Values, but you have to do it for each marker. For a refreshable table it's worth the setup; for a one-off copy it's a lot of clicking.
Method 3: a browser extension
The free TableTap extension for Chrome reads the table from the page you have open:
- Open the Wikipedia article and click the TableTap button in the toolbar.
- TableTap lists the tables on the page with a name and their size in rows and columns. Hover one to highlight it in the article, so you know you've got the right one.
- Click Copy Excel/Sheets and paste into Excel or Google Sheets, or click Download CSV to save it as a file.
Merged cells, which Wikipedia uses a lot for grouped rows, are expanded into a regular grid, so every row has the same number of columns. TableTap Pro can also drop numbered footnote markers like [1], trim stray spaces and convert numbers like 1,234,567 into real numbers before you copy, and export straight to an .xlsx file.
Cleaning up what Wikipedia leaves behind
- Footnote markers like [1], [a] or [note 3]: in Excel or Sheets, use Find and Replace with a regular expression. In Google Sheets, tick Search using regular expressions and replace
\[[^\]]*\]with nothing. Excel's own Find and Replace doesn't support regular expressions, but theREGEXREPLACEfunction in recent versions of Excel 365 does. - Numbers stored as text: check for spaces, footnotes or symbols in the cell, remove them, then format the column as a number.
- Dates in odd formats: Wikipedia writes dates in the style of the article's language. If Excel doesn't recognise them, use Data > Text to Columns and set the date order explicitly.
- Flags and icons: they don't copy as text, so columns that only contain a flag come through empty. Delete them.
Can I reuse Wikipedia data?
Wikipedia's text is published under a Creative Commons Attribution-ShareAlike licence. Plain facts and figures are generally free to use, but if you publish a substantial part of a table, credit Wikipedia and link to the article. When the numbers matter, follow the footnote to the original source and check it there.
Doing this often? TableTap is a free Chrome extension that lists every table on a page and copies it ready for Excel or Google Sheets. TableTap Pro (€19 once) adds real .xlsx export and clean-up options.