Main content

IMPORTHTML in Google Sheets, Pull a Table

By Szabó Gergő · Updated

IMPORTHTML fetches a public URL and reads the nth table or list. Prefer official CSV or API exports when they exist.

Syntax and arguments

=IMPORTHTML(url, query, index)
url
Public page, including https.
query
"table" or "list".
index
1-based position of that table or list on the page.

IMPORTHTML examples

01
First table

A public stats page.

=IMPORTHTML("https://example.com/stats","table",1)

Imports the first HTML table. Change the index if the page has several.

02
A list

FAQ list on a public page.

=IMPORTHTML("https://example.com/faq","list",1)

Reads an ordered or unordered list.

03
URL in a cell

URL stored in A1.

=IMPORTHTML(A1,"table",1)

Sheets caches imports. Source edits can take minutes to appear.

Common mistakes

  • JavaScript-rendered pages

    View source. If the table is not in HTML, IMPORTHTML cannot see it.

  • Wrong table index

    Count tables in the raw HTML, not what you see after ads load.

  • Scraping a login wall

    This function cannot authenticate. Use a published CSV instead.

IMPORTHTML FAQ

Why is IMPORTHTML empty?

The page may render in JavaScript, block scrapers, or use a different table index.

Is this allowed on every site?

Check the site terms. Prefer official exports when they exist.

Does Excel have IMPORTHTML?

No. Excel uses Get Data / Power Query from Web.