Skip to content
Google Sheets

IMPORTHTML function in Google Sheets

Imports data from a table or list within an HTML page.

=IMPORTHTML(url, query, index)

IMPORTHTML syntax and parameters

Three arguments, three required.

  • urlstringRequired

    The URL of the page to examine, including protocol (e.g. http://). The value for url must either be enclosed in quotation marks or be a reference to a cell containing the appropriate text.

  • querystringRequired

    Either "list" or "table" depending on what type of structure contains the desired data.

  • indexnumberRequired

    The index, starting at 1, which identifies which table or list as defined in the HTML source should be returned. The indices for lists and tables are maintained separately, so there may be both a list and a table with index 1 if both types of elements exist on the HTML page.

IMPORTHTML examples

Formulas you'll actually reuse.

  1. The first table on a Wikipedia page:

    =IMPORTHTML("https://en.wikipedia.org/wiki/List_of_countries_by_population", "table", 1)
  2. The second bulleted list on a page, one item per row:

    =IMPORTHTML("https://example.com/pricing", "list", 2)

IMPORTHTML in Excel

No direct equivalent — here's the way around.

Try IMPORTHTML in the playground

Edit the example — nothing to install.

Preloaded with the IMPORTHTML formula from Example 1 — change anything and watch it respond.

Loading the editor…

IMPORTHTML errors

What they mean — and the fixes.

  • #N/A

    No table or list at that index — count from 1, and remember that pages built with JavaScript may have none in the raw HTML.