Quillfold

IMPORTHTML returns an error or the wrong table

IMPORTHTML puts a table from a web page into Google Sheets with one formula, and keeps it up to date. When it works, nothing else is as simple. When it doesn’t, the cell shows an error, the wrong table, or nothing.

Everything quoted from Google below comes from the Google Docs Editors Help pages, read on 7 October 2026.

The formula

=IMPORTHTML("https://example.com/prices", "table", 2)
  • url: the page address, including https://.
  • query: “Either “list” or “table”, depending on what type of structure contains the desired data.”
  • index: “The index, starting at 1, which identifies which table or list as defined in the HTML source should be returned.”

Google’s help page shows these three arguments and no others.

Why it picks the wrong table

The index is easy to get wrong, for three reasons Google’s help page explains:

  1. It counts from 1, not 0.
  2. It counts in the HTML source, not on the screen. A table that appears first on screen can be the third <table> in the source; layout tables, hidden tables and tables in menus all count.
  3. Tables and lists are counted separately. “The indices for lists and tables are maintained separately, so there may be both a list and a table with index 1.”

To find the right index:

  1. Open the page and view its source: Ctrl+U in Chrome on Windows, Option+Command+U on Mac.
  2. Search (Ctrl+F / Command+F) for <table. Each match is one table, in the order IMPORTHTML counts them.
  3. Find the one that contains a value you can see in your table. Its position in the list of matches is the index.

If you don’t want to count, try indexes 1, 2, 3… one per cell next to each other and keep the one that matches.

When there’s no table to find

Google describes the index as counting tables “as defined in the HTML source”. Its help page doesn’t say whether it can read tables that the page builds with JavaScript after loading, or pages that need you to sign in. You can check your page:

  1. View the source (as above).
  2. Search for a value you can see in the table.
  3. If it isn’t there, the table is built after the page loads, and the formula has nothing to find at that index.

The same applies to tables that are not <table> elements at all, such as grids made of <div>s: query can only be "table" or "list".

Errors Google documents

Google’s page “Learn more about Import functions” lists these:

  • “Loading data may take a while because of the large number of requests. Try to reduce the amount of IMPORTHTML, IMPORTDATA, IMPORTFEED, or IMPORTXML functions across spreadsheets you’ve created.” You have too many import formulas. Combine or remove some.
  • “This function is not allowed to reference a cell with NOW(), RAND(), RANDARRAY(), or RANDBETWEEN().” The url argument points to a cell that uses one of these, often to force a refresh. Remove the reference.
  • “Admin has not allowed imports from…” Your Google Workspace administrator has blocked imports.
  • Import functions “cannot be used to import Excel files.”

If you see a message that isn’t listed here, Google’s help pages don’t describe it, and this guide doesn’t either.

How often it refreshes

From the same page: “All three functions automatically check for updates every hour while the document is open, even if the formula and sheet don’t change.” And: “If you delete and re-add cells or overwrite the cells with the same formula, it triggers a refresh of the functions.” Google’s calculation-settings page gives the same one-hour interval for ImportHtml.

So data can be up to an hour old, and refreshes while the sheet is open. If you need it fresher, re-enter the formula.

Pages

IMPORTHTML reads one address. Google’s help doesn’t mention following Next or Load more. If each page has its own address (?page=2), use one formula per page and place them one under another. If the address doesn’t change, IMPORTHTML can’t reach page 2. See When the next page isn’t captured.

Other ways (as of October 2026)

SituationWhat to use
The site offers a CSV file at a fixed address=IMPORTDATA(url), which “Imports data at a given url in .csv (comma-separated value) or .tsv (tab-separated value) format.”
The table is in the source and you want it to stay up to dateIMPORTHTML. Nothing else in Sheets refreshes on its own like this.
The table is built by scripts, behind a sign-in, or spread over pages without their own addressesA browser extension, which reads the page you have open; then upload or paste the result.
You work in Excel on WindowsData > From Web. See Excel “From Web” can’t see your table.

TableHarvest, our extension, reads the tab you have open, so it sees tables built by scripts and pages you are signed in to. It downloads XLSX, CSV and other formats, which you can then open in Google Sheets. It doesn’t write to Google Sheets directly and doesn’t refresh: each capture is a snapshot. If IMPORTHTML can read your table and you want it live, keep using IMPORTHTML.

Sources

Read on 7 October 2026.

All guides