Skip to content
Home

/

Glossary

/

Data

/

IMPORTHTML

Data

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

Key facts

Made byGoogle (a built-in Google Sheets function)
SyntaxIMPORTHTML(url, query, index)
query values"table" or "list"
indexStarts at 1; tables and lists are counted separately in source order
RefreshGoogle checks the source for updates hourly while the spreadsheet is open
JavaScriptNot 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).

  • url: the page, including https://, in quotes or as a cell reference.
  • query: either "table" (an HTML <table>) or "list" (an <ul> or <ol>).
  • index: which table or list, counting from 1 in the order they appear in the HTML source. Tables and lists have separate counters, so a page can have both a table 1 and a list 1.
  • 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:

  • Only the raw HTML counts. If a table is drawn by JavaScript after the page loads, or is actually a grid of <div> elements styled to look like a table, IMPORTHTML will not see it as a table.
  • The index follows the source, not the screen. Hidden tables, layout tables and tables in collapsed sections all count. The table you see first on screen may be index 3.
  • No session. The fetch carries no cookies, so pages behind a login return the login page instead.
  • Hourly updates. Google's help center says import functions check the source for updates hourly while the document is open, and reloading the sheet does not force a fetch.
  • What people use IMPORTHTML for

  • Pulling reference tables from Wikipedia into a sheet for analysis.
  • Tracking sports standings, fund holdings or rate tables published as static HTML.
  • Grabbing a bulleted list such as a changelog or a directory of links.
  • Building quick dashboards from public statistics pages that publish plain tables.
  • 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

  • Imported content is empty. The page has no table or list at that index in its raw HTML. Either the index is wrong, the content is rendered by JavaScript, or the "table" is built from <div> elements. View the page source and count <table> tags.
  • Wrong table imported. The index counts every table in the source, including hidden ones. Try neighboring index numbers.
  • Could not fetch url. Google's fetcher was blocked, received an error, or the URL is malformed. See the Could not fetch url guide; the causes are the same as for IMPORTXML.
  • Resource at url contents exceeded maximum size. The page is too large for Sheets to import.
  • Data shifts or breaks without warning. When the site adds a table above yours, the index points to a different table. Nothing alerts you.
  • Loading... indefinitely or a traffic warning. Too many import functions are generating requests across your spreadsheets; Google recommends reducing them.
  • 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 more

    Examples

    • 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

    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.

    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.

    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.

    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.

    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.

    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.

    Related terms, automations and guides

    Where this concept shows up in practice.

    DefinitionIMPORTXMLIMPORTXML is a Google Sheets function that fetches a URL from Google's servers and returns whatever an XPath query selects from the page, such as titles, prices or links. It reads only the raw HTML, so it cannot see content that JavaScript adds after the page loads.DefinitionGoogle Sheets APIThe Google Sheets API is Google's REST API for reading and writing Google Sheets from your own code. Version 4 exposes cell values, formatting, charts and sheet structure, and is limited by per-minute quotas of 300 requests per project and 60 per user, separately for reads and writes.DefinitionGoogle Apps ScriptGoogle Apps Script is Google's cloud-hosted JavaScript platform for automating Google Workspace: Sheets, Gmail, Drive, Docs, Calendar and Forms. Scripts run on Google's servers, can be triggered on a schedule or by events, and are limited by daily quotas such as a 6-minute cap per execution.DefinitionPaginationPagination is how websites and APIs split a long list across several pages or loads: page-number URLs, Next links, "Load more" buttons, infinite scroll or cursor tokens. Scraping a paginated site means identifying the pattern, walking every page, knowing when to stop and removing duplicates.DefinitionStructured DataStructured data is information organized in a predefined, predictable format — typically rows and columns in databases, spreadsheets, or tabular files like CSV and JSON. Each field has a defined type and position, making it easy to query, filter, and analyze programmatically.DefinitionData ScrapingData scraping is the broad practice of programmatically extracting data from any digital source — websites, applications, databases, documents, or APIs. It encompasses web scraping, screen scraping, and other automated extraction techniques.GuideIMPORTXML "Could Not Fetch URL" and "Imported Content Is Empty": Causes and FixesWhy Google Sheets' IMPORTXML and IMPORTHTML return "Could not fetch url", "Imported content is empty" or endless Loading, how to tell which cause you have in a minute, and what to use when the page is JavaScript-rendered, blocked or behind a login.GuideHow to Scrape and Crawl Dynamic Websites (Why JavaScript Pages Come Back Empty)Why requests, BeautifulSoup and Google Sheets' IMPORTXML return empty results on JavaScript pages, and the four ways to get the data: embedded JSON, the site's own XHR/JSON endpoints, a rendered browser with proper waits, and handling infinite scroll, load-more buttons and JS-built links when crawling.

    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.

    See Features