IMPORTHTML Function Reference — Google Sheets (2026)
Home›Google Sheets›Functions›IMPORTHTML
Google Sheets OnlyReference

IMPORTHTML Function Reference

IMPORTHTML pulls tables and lists from public web pages straight into your sheet. Wikipedia tables. Stock market indices. Sports league standings. Product catalogs. Anything that lives as a <table> or <ul>/<ol> on a publicly accessible URL — one formula pulls it in and refreshes it automatically. This reference covers syntax, table vs list queries, common patterns, refresh behavior, and the alternatives (IMPORTXML, IMPORTDATA, IMPORTFEED) when IMPORTHTML doesn't fit.

⚡ Quick Answer

IMPORTHTML syntax: =IMPORTHTML(url, query, index). Query is "table" or "list". Index is which table/list on the page (1-based). Result spills as an array — headers plus data rows. Refreshes approximately hourly. Only works on static HTML (no JavaScript-rendered content). Sheets-only function; Excel has Power Query for similar workflows.

Syntax

IMPORTHTML syntaxIMPORTHTML(url, query, index)
  • url — full URL of the web page (must include https://)
  • query — either "table" (fetches a <table>) or "list" (fetches a <ul> or <ol>)
  • index — which table or list on the page, counting from 1

Common examples

Wikipedia table

S&P 500 companies from Wikipedia
=IMPORTHTML("https://en.wikipedia.org/wiki/List_of_S%26P_500_companies", "table", 1)
Wikipedia is IMPORTHTML's most reliable source — clean HTML tables, well-structured pages. This pulls the first table on the S&P 500 page.

Country GDP list

Country GDP rankings
=IMPORTHTML("https://en.wikipedia.org/wiki/List_of_countries_by_GDP_(nominal)", "table", 2)
The second table on this page (first is often a summary or navigation table). Trial-and-error on the index until you find the right one.

Table of contents as list

Extract page navigation
=IMPORTHTML("https://example.com/docs", "list", 1)
Pulls the first ordered or unordered list on the page. Useful for scraping table-of-contents navigation, menu items, or bullet-point content.

Finding the right index

The index parameter is 1-based and counts all tables (or lists) on the page in HTML source order — including invisible layout tables. Finding the right index is often trial-and-error:

  1. Start with index=1
  2. If the result isn't what you want, try 2, 3, etc.
  3. Some pages have 10+ tables before the one you actually want
Ask AI to find the right index

Paste the URL into ChatGPT/Claude and ask: "How many <table> elements are on this page, and which one contains the [description] data?" Faster than counting manually. See our Generate Sheets formulas with AI guide.

Refresh behavior

IMPORTHTML data refreshes automatically, but not in real time.

  • Default refresh: Approximately every hour
  • On sheet open: Refreshes when the sheet is loaded
  • Manual refresh: Delete the formula and re-enter it
  • Force refresh: Add a dependency on NOW() to trigger recalculation
Force periodic refresh
=IF(NOW(), IMPORTHTML("URL", "table", 1))
Wrapping in IF(NOW(),...) makes the formula recalculate every time the sheet updates. Combine with a time-based Apps Script trigger to refresh at a specific schedule.

Limitations

Static HTML only

IMPORTHTML fetches the raw HTML that a server returns. It doesn't run JavaScript. If a page renders its data client-side (React, Vue, or heavy AJAX), IMPORTHTML sees an empty template, not the data. Test by opening the page in a browser with JavaScript disabled — if the content isn't visible, IMPORTHTML can't reach it.

Rate limits and quotas

IMPORT functions share a quota

Google Sheets limits how many external calls (IMPORTHTML, IMPORTXML, IMPORTDATA, IMPORTFEED, IMPORTRANGE) can run simultaneously. Sheets with many IMPORT functions may hit quota errors showing as #N/A or persistent "Loading...". Consolidate IMPORT calls where possible; convert results to static values once satisfied.

No authentication

IMPORTHTML only works on publicly accessible URLs. It can't fetch pages behind login walls, sessions, or authentication tokens. For authenticated APIs, use Apps Script with UrlFetchApp.

Site permissions

Some sites block Google's fetcher via robots.txt or IP restrictions. If a URL consistently returns #N/A despite being publicly accessible, the site may be blocking automated fetches.

Format changes break the formula

IMPORTHTML depends on the page's structure. If the site owner adds or removes a table, redesigns the page, or restructures the HTML, your formula may pull the wrong data or fail. For long-term reliability, use an official API when available.

IMPORTHTML vs the other IMPORT functions

FunctionBest forData format
IMPORTHTMLTables and lists on public pagesHTML <table>, <ul>, <ol>
IMPORTXMLAny HTML element via XPathAny structured markup
IMPORTDATACSV or TSV filesComma/tab-separated files
IMPORTFEEDRSS or Atom feedsXML feed format
IMPORTRANGERanges from other Google SheetsSheets to Sheets

When to use each

  • IMPORTHTML — public web page with a clean HTML table or list you can identify by index
  • IMPORTXML — you need something more specific than "the second table" — an element with a specific class, or nested data. Uses XPath selectors
  • IMPORTDATA — the source is a CSV/TSV file (Google Docs published as CSV, government data downloads, exchange rate feeds)
  • IMPORTFEED — RSS/Atom feeds from blogs, news sites, or podcast catalogs
  • IMPORTRANGE — data lives in another Google Sheet you have access to. See our IMPORTRANGE complete guide

Common use cases

Currency conversion rates

Some financial data pages publish rates as tables that IMPORTHTML can grab. Better alternative: =GOOGLEFINANCE("CURRENCY:USDGBP") for major currencies. See GOOGLEFINANCE complete guide.

Sports league standings

Wikipedia league standings tables refresh regularly and IMPORTHTML can pull them. Combine with FILTER to focus on a specific division.

Government or public data

Public health tables, census data, and legislative records often live as HTML tables. IMPORTHTML pulls them without needing to download files.

Cryptocurrency prices

Various crypto tracking sites publish tables IMPORTHTML can fetch. Reliability varies — some sites deliberately block automated fetches.

Import Helper

Sheets Wizard — finds the right IMPORTHTML index

Paste a URL, describe what you want ("get the market cap column from the S&P 500 table"), and Sheets Wizard identifies the correct table index and generates the formula — often with a wrapping FILTER or QUERY to get just the columns you need.

Also flags JavaScript-rendered pages where IMPORTHTML won't work, suggesting alternatives before you spend time debugging.

Install Sheets Wizard →

Frequently asked questions

What does IMPORTHTML do?

IMPORTHTML pulls a table or list from a public web page into Google Sheets. Syntax: =IMPORTHTML(url, query, index). The query is either "table" or "list", and the index picks which table or list on the page (1-based). It's the fastest way to scrape structured web data — Wikipedia tables, stock indices, sports stats, product catalogs — without writing code or using an API.

How do I find the right index number for IMPORTHTML?

Trial and error is standard. Start with index 1, check the result, increment if it's not the table or list you want. Pages often have 3-15 tables (invisible layout tables plus content tables), so the right index isn't always intuitive. Tip: use browser DevTools to inspect the page, count <table> or <ul>/<ol> elements from the top, or use ChatGPT with the page URL to identify the right index without manual counting.

Does IMPORTHTML auto-refresh?

Yes, but on Google's schedule — approximately every hour, not in real time. For faster refresh, add a dependency on a volatile function like NOW() to force recalculation. For guaranteed refresh timing, use Apps Script with a time-based trigger to call the fetch manually. IMPORTHTML is best for data that changes hourly or less often.

Why is IMPORTHTML returning #N/A?

Common causes: (1) The page uses JavaScript to render content — IMPORTHTML only sees the static HTML, not JS-rendered elements. (2) The site blocks Google's fetcher via robots.txt. (3) The index is out of range for the number of tables/lists on the page. (4) The URL requires authentication. Test by opening the page in a browser with JavaScript disabled — if the data isn't visible in raw HTML, IMPORTHTML can't reach it either.