Check Sheet Logo
Check Sheet

IMPORTHTML

The IMPORTHTML function is used to import data from a table or list within an HTML page. This function is commonly used to pull data from websites and display it in a Google Sheet.

Usage

Use the IMPORTHTML formula with the syntax shown below, it has 2 required parameters and 1 optional parameter:

=IMPORTHTML(url, query, index)
Parameters:
  1. url (required):
    The URL of the webpage to import data from.
  2. query (required):
    A query that selects the table or list to import. This should be in the form of an XPath or CSS selector.
  3. index (optional):
    The index of the table or list to import, if there are multiple on the page. This parameter is optional and defaults to 0.

Examples

Here are a few example use cases that explain how to use the IMPORTHTML formula in Google Sheets.

Importing a table from a webpage

You can use IMPORTHTML to easily import a table from a webpage into a Google Sheet. Simply provide the URL of the webpage and the query that selects the table, and the function will return the table data.

Importing a list from a webpage

In addition to tables, IMPORTHTML can also be used to import lists from webpages. Simply provide the URL of the webpage and the query that selects the list, and the function will return the list data.

Updating imported data

Since IMPORTHTML pulls data from a webpage, you can set up your sheet to automatically update this data at regular intervals. This can be done using a script or by creating a timed trigger in Google Sheets.

Common Mistakes

IMPORTHTML not working? Here are some common mistakes people make when using the IMPORTHTML Google Sheets Formula:

Incorrect URL

One common mistake when using the IMPORTHTML function is entering an incorrect URL. Make sure you have entered the correct URL for the webpage you want to import data from.

Incorrect query type

Another common mistake is entering an incorrect query type. Make sure you have entered 'table', 'list', or 'html' as the query type.

Incorrect index

If there are multiple tables or lists on the webpage you are importing data from, you need to specify the index of the table or list you want to import. Make sure you have entered the correct index number.

The following functions are similar to IMPORTHTML or are often used with it in a formula:

  • IMPORTXML

    The IMPORTXML formula allows you to import data from an XML or HTML document on the web. This can be useful for scraping data from websites or for importing data from APIs that return XML data. The formula takes a URL and an XPath query as inputs and returns the data that matches the query.

  • IMPORTDATA

    The IMPORTDATA function imports data from a URL in CSV or TSV format into a Google Sheet. The data is automatically refreshed by Google Sheets every hour, or you can manually refresh it by clicking on the cell and selecting 'Data' > 'Refresh data'.

  • IMPORTFEED

    The IMPORTFEED function in Google Sheets is used to import an RSS or ATOM feed and display the content in a tabular format in the sheet. It requires only the URL of the feed as a parameter.

  • QUERY

    The QUERY function in Google Sheets is used to query data from a specified dataset. The function allows users to filter and sort data based on specific criteria. The function is commonly used in data analysis and reporting, as well as in creating dynamic dashboards.

Learn More

You can learn more about the IMPORTHTML Google Sheets function on Google Support.