How to copy a table from a website to Excel or Google Sheets
September 23, 2026
Below are five ways to get a web table into a spreadsheet. We ran three of them on two Wikipedia tables that are hard to copy: the largest companies by revenue, where some cells are merged across rows, and the largest cities, where footnote marks follow the numbers. For IMPORTHTML in Google Sheets and From Web in Excel, we describe how they work and where they stop.
Why the copy comes out messy
Web tables are made to be read, not calculated. In the companies table, a single Oil and gas cell covers three companies. In the cities table, the density of Jakarta reads 15,292[14]. A spreadsheet needs a value in every row of every column, and 15,292[14] is text, so SUM and charts skip it.
1. Copy and paste
Select the table, copy it and paste it into the sheet. For a small table without merged cells, this is the quickest way.
In our test, Excel 2019 for Mac ignored the cells merged across rows, and the values after them moved one column to the left: the revenue of China National Petroleum Corporation, 476, landed in the Industry column. Amazon took two rows because its industry cell has two lines. In the cities table, each city took two rows, with most footnote marks in the second one.
Other versions of Excel and Google Sheets can paste differently. Whatever you paste into, check the rows under merged cells before you use the numbers.
2. IMPORTHTML in Google Sheets
Type this into a cell, and Sheets loads the table and refreshes it from time to time:
=IMPORTHTML("https://en.wikipedia.org/wiki/List_of_largest_companies_by_revenue", "table", 1)
The last number is the table's position among all tables in the page's HTML, and it isn't always what you see: on the cities page the table you want is number 2, because the sidebar is built as a table too.
Sheets downloads the page from Google's servers and doesn't run its scripts. It won't see a table that the page builds with JavaScript, and it can't open pages that need you to sign in. Footnote marks come in together with the numbers.
3. From Web in Excel for Windows
In Excel for Windows, choose Data > From Web, paste the page address and press OK. The Navigator window lists the tables it found. Pick one and press Load. Excel remembers the address, so Data > Refresh All brings in fresh numbers later.
From Web can sign in with a Windows, Basic, API key or Microsoft work account, but not through a website's own login form, so pages you see only after signing in usually stay out of reach. On a Mac it isn't available: web pages are missing from the list of sources that Power Query in Excel for Mac can import from.
4. A few lines of code
In Chrome, open the console with Ctrl+Shift+J (Cmd+Option+J on a Mac) and run the code below. It copies the first table on the page as text that pastes into columns. The first time, Chrome asks you to type allow pasting before it accepts pasted code.
const table = document.querySelectorAll('table')[0]; // 0 is the first table on the page
copy([...table.rows]
.map(row => [...row.cells].map(cell => cell.innerText.replace(/\s+/g, ' ').trim()).join('\t'))
.join('\n'));
This works on any page you can see, including pages you're signed in to. It doesn't handle merged cells: in the companies table, the rows under the merged Oil and gas cell came out one or two values short, and 476 again landed under Industry.
In Python, pandas reads tables from a page's HTML. Install pandas, lxml, openpyxl and requests first.
from io import StringIO
import pandas as pd
import requests
url = "https://en.wikipedia.org/wiki/List_of_largest_cities"
html = requests.get(url, headers={"User-Agent": "tables-demo/1.0"}).text
tables = pd.read_html(StringIO(html), match="Urban area")
tables[0].to_excel("cities.xlsx")
pandas repeats a merged cell's value in every row it covers, so each of the three oil companies got its industry. Footnote marks stay: in the cities table 9 of the 10 number columns came back as text, and the Excel file stored even plain numbers in them, like 10154134, as text. Like IMPORTHTML, pandas reads the HTML the server sends, without running the page's scripts.
5. A browser extension
An extension reads the table from the page open in your browser, so tables built by scripts and pages you're signed in to work too. It needs a real HTML table: a grid built from other elements isn't detected, and for that a scraper such as Instant Data Scraper fits better. An extension copies what is on the page, so a table split into pages comes one page at a time.
Table Capture and Copytables have done this for years. We make TidyKit Table to Excel. On the companies table it repeated Oil and gas in all three rows, put United States next to Walmart and left out the Ref. column, which held only footnote marks. On the cities table it removed every footnote mark, and in its XLSX file the numbers are numbers.
To use it, click the extension's icon, press Copy on the table and paste, or save the table as CSV or XLSX.
Which one to use
| Way | Tables built by scripts | Pages behind a sign-in | Updates itself | Merged cells and footnote marks |
|---|---|---|---|---|
| Copy and paste | Yes | Yes | No | Shifted and kept in our test |
IMPORTHTML | No | No | Yes | Footnote marks kept |
| From Web, Excel for Windows | Depends on the page | Not through a login form | On refresh | Footnote marks kept |
| Console code | Yes | Yes | No | Shifted and kept |
| pandas | No | With extra code | When you rerun it | Merged cells filled, marks kept |
| TidyKit Table to Excel | Yes | Yes | No | Filled and removed |
- A small table without merged cells, once: copy and paste.
- A sheet that should follow a public page:
IMPORTHTMLin Google Sheets, or From Web in Excel for Windows. - Many pages or a regular job: pandas.
- Merged cells, footnote marks, pages behind a sign-in or tables built by scripts: an extension.