Category: FUNCTION | Updated: 2026-11-22

How to Use the IMPORTHTML Function: Import Entire Tables and Lists from Web Pages

Overview of the IMPORTHTML Function

The IMPORTHTML function imports an entire HTML table (<table> tag) or list (<ul> or <ol> tag) from a web page into Google Sheets while preserving its layout. You can easily pull in tabular data without needing to know XPath.

Syntax

=IMPORTHTML(url, query, index)
  • url: The URL of the target web page ("https://...").
  • query: Specify "table" to import a table, or "list" to import a list.
  • index: An integer of 1 or greater specifying which table or list on the page (counting from the top) to import.

Practical Examples with a Table

This example imports the first table or second list from a Wikipedia page.

Cell A (Target URL) B (Formula) C (Sample Result)
1 URL Formula Result
2 https://ja.wikipedia.org/wiki/日本の都道府県 =IMPORTHTML(A2, "table", 1) The 1st table on the page expands starting from cell B2
3 https://ja.wikipedia.org/wiki/日本の都道府県 =IMPORTHTML(A3, "list", 2) The 2nd list on the page expands vertically

Common Errors and Precautions

  • Cell collision in the output range (#REF! error): IMPORTHTML automatically expands data rightward and downward based on the size of the imported table. If any cell in that expansion area already contains text or a formula, a #REF! error occurs, so keep surrounding cells empty.
  • Shifted index numbers: If a site’s design changes and hidden layout <table> elements are added or removed, a different table than intended may be imported. Adjust the index number by 1 at a time to verify.
  • Dynamic sites and login-required sites: Like IMPORTXML, it cannot import tables rendered dynamically by JavaScript or pages requiring login.

Frequently Asked Questions

Q. What is the 'index' argument in the IMPORTHTML function?

A. It is a 1-based number specifying which table or list on the web page (counting from the top) you want to import.

Q. How often does a table imported with IMPORTHTML refresh?

A. By Google Sheets' design, it refreshes automatically roughly every 1 to 2 hours. To force an immediate refresh manually, you need workarounds like appending a dummy parameter to the URL.