5 min read
Also: =IMPORTHTML, IMPORTHTML function, Google Sheets IMPORTHTML, import table from website Google Sheets, IMPORTHTML table index, importhtml list
IMPORTHTML
Quick answer
IMPORTHTML is a Google Sheets function, =IMPORTHTML(url, "table", index) or "list", that imports one HTML table or list from a page, counting tables and lists separately from 1. It reads only the raw HTML, so a table built by JavaScript comes back blank; see the "Imported content is empty" fix.
IMPORTHTML is a Google Sheets function that imports a whole HTML table or list from a web page into your spreadsheet, chosen by its position on the page. It is the quickest way to pull a static table into Sheets, and it shares IMPORTXML's limits: no JavaScript, no logins, hourly refresh.
Last verified
What people do with IMPORTHTML
- Fix "Imported content is empty"
Wrong index, or the table is drawn by JavaScript after the page loads.
- Fix "Could not fetch url"
The site refuses Google's fetcher or the URL needs a login.
- Fix "Array result was not expanded"
The imported table would overwrite cells that already contain data.
- Fix IMPORTHTML stuck on "Loading..."
Usually too many import formulas across your files; how to cut them down.
- Check IMPORTHTML limits and refresh rules
Hourly refresh, size caps and how re-entering the formula forces a fetch.
- Find the table you want with a CSS selector
Test table.wikitable or table:nth-of-type(2) to see which index you need.
- Scrape stock market tables on a schedule
A real-browser alternative for JavaScript tables IMPORTHTML cannot see.
Key facts
| Made by | Google (a built-in Google Sheets function) |
|---|---|
| Syntax | IMPORTHTML(url, query, index) |
| query values | "table" or "list" |
| index | Starts at 1; tables and lists are counted separately in source order |
| Refresh | Google checks the source for updates hourly while the spreadsheet is open |
| JavaScript | Not executed; only tables and lists present in the raw HTML are visible |
What is IMPORTHTML?
IMPORTHTML is a built-in Google Sheets function that copies a table or a list from a web page into a range of cells. You tell it which page, whether you want a table or a list, and which one by number, and Sheets fills the grid. A Wikipedia table of countries, a league standings table, a public price list: if it is a real HTML <table> element in the page source, IMPORTHTML can usually get it in one formula.
Google documents the function in the Google Docs Editors Help center with this signature: IMPORTHTML(url, query, index).
https://, in quotes or as a cell reference."table" (an HTML <table>) or "list" (an <ul> or <ol>).Example: =IMPORTHTML("https://en.wikipedia.org/wiki/List_of_largest_cities", "table", 2) imports the second table on that page.
How it works
Like IMPORTXML, IMPORTHTML is executed on Google's servers. They download the page, parse the HTML, find the nth <table> or list element and return its cells. The table's own header row becomes the first row of the result.
That design explains its behavior:
<div> elements styled to look like a table, IMPORTHTML will not see it as a table.What people use IMPORTHTML for
When you need individual elements rather than a whole table, such as one price or every link, use IMPORTXML with an XPath query instead.
Common IMPORTHTML problems
<div> elements. View the page source and count <table> tags.IMPORTHTML and automation
IMPORTHTML is ideal for one stable, public, server-rendered table. It is not built for paginated results, tables that load as you scroll, filters you have to click, or pages behind a sign-in, and it gives you no control over when it runs. To refresh on a fixed schedule, people often wrap it in Google Apps Script with a time-driven trigger, or write the data through the Google Sheets API from a scheduled job.
When the table is JavaScript-rendered or split across pages, the fix is a real browser. Autonoly runs extraction in Chromium, so tables built by scripts are present, and its table and list extraction steps can follow a Next button for pagination. Results go into a sheet through the native Google Sheets integration, and a scheduled workflow controls when the data refreshes. It does not use proxies, so a site that blocks automated traffic may block it too. For a step-by-step comparison, see how to scrape a website to Google Sheets.
Why It Matters
IMPORTHTML turns a public HTML table into spreadsheet rows with one formula, which makes it the fastest route for simple, static data. Its blind spots (JavaScript-rendered tables, div-based grids, logins, pagination, hourly refresh) are exactly where spreadsheet-based data collection tends to break.
How Autonoly Solves It
Autonoly extracts tables and lists from pages loaded in a real Chromium browser, so tables rendered by JavaScript are available. Table and list steps can follow a Next button across pages, and the rows are written to Google Sheets through the native integration on the schedule you set. It does not rotate IPs or use proxies.
Learn moreExamples
Importing a Wikipedia table of country populations with =IMPORTHTML(url, "table", 1) and charting it in the same sheet
Pulling a static league standings table into a sheet that recalculates points-per-game alongside it
Replacing an IMPORTHTML formula that returns nothing on a JavaScript-rendered pricing table with a browser workflow that extracts the table and appends it to Google Sheets each morning
Frequently Asked Questions
How do I find the right index for IMPORTHTML?
Count the <table> elements (or <ul>/<ol> for lists) in the page source, starting at 1. Hidden and layout tables count too, so the first table you see may not be index 1. When unsure, try neighboring numbers until the right table appears.
Why does IMPORTHTML return nothing on some sites?
Either the table is rendered by JavaScript after load, so it is not in the raw HTML Google downloads, or the visual 'table' is built from div elements rather than a real <table>. Check view-source: for a <table> tag. If none exists, IMPORTHTML cannot import it.
Can IMPORTHTML import more than one table at once?
No. Each formula returns one table or list. To combine several, use one IMPORTHTML per table and stack the results, for example with curly-brace array notation such as {IMPORTHTML(url,"table",1);IMPORTHTML(url,"table",2)} when the columns match.
How often does IMPORTHTML update?
Google's help center says import functions check for updates hourly while the spreadsheet is open. Reloading does not force a refresh; re-entering the formula does. For a predictable schedule, use an Apps Script time-driven trigger or a scheduled scraper that writes to the sheet.
What is the difference between IMPORTHTML and IMPORTXML?
IMPORTHTML imports a whole table or list by position and needs no query language. IMPORTXML takes an XPath expression, so it can select individual elements and attributes anywhere on the page. Both run on Google's servers and neither executes JavaScript.
Can IMPORTHTML follow pagination?
No. It fetches one URL. If page 2 has its own URL (for example ?page=2) you can write one formula per page, but tables paginated by a button or infinite scroll need a browser-based scraper.
Further reading
Related terms, automations and guides
Where this concept shows up in practice.
Stop reading about automation.
Start automating.
Describe what you need in plain English. Autonoly's AI agent builds and runs the automation for you — no code required.