How to import a table from a website into Google Sheets
In Google Sheets, =IMPORTHTML("address", "table", 1) pulls the first table of a
public page. When the page needs a login or builds its table with JavaScript, IMPORTHTML comes
back empty: copy the table with NeatCells instead and paste it into Sheets.
1. IMPORTHTML
Type this in an empty cell, with the page's address in quotes:
=IMPORTHTML("https://example.com/prices", "table", 1)
- The last number picks the table: 1 is the first table in the page's code, 2 the second.
-
Use
"list"instead of"table"for a bulleted or numbered list. - Sheets fetches the page again from time to time, so the data stays roughly current.
IMPORTHTML is fetched by Google's servers, not by your browser. So it cannot open pages behind your login, it does not run the page's scripts (many modern tables are built that way), and some sites refuse Google's request. "Imported content is empty" or "Could not fetch url" are the usual signs.
2. IMPORTXML for things that are not tables
=IMPORTXML("address", "//h2") returns every matching element, chosen with an
XPath expression. It can read product names or prices from card layouts, but you need one
formula per column, and the same limits apply as for IMPORTHTML.
3. Copy with NeatCells and paste
- Open the page in Chrome and click the NeatCells icon.
- Check the preview: columns are named and typed, buttons and icons are left out.
- Click Copy, then click a cell in Google Sheets and press Ctrl+V.
The rows paste as columns, with numbers Sheets can add up. For a file instead, use Download Excel or CSV and open it with File › Import in Sheets.
Questions
Why does IMPORTHTML say "Imported content is empty"?
The table is probably built by the page's JavaScript, or the site blocks Google's fetcher. Open the page in your browser and copy the table with an extension that reads what you see.
How often does IMPORTHTML refresh?
Google refreshes imported data on its own schedule, roughly hourly while the sheet is in use. There is no button to force it, but editing the formula fetches the page again.
Can I import a table that needs a login?
Not with IMPORTHTML. NeatCells works inside your own signed-in browser, so it can read any table you can see.