IMPORTHTMLfunction 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.
- How to use
- Examples of using
IMPORTHTMLformula not working?
- Similar formulas to
IMPORTHTML formula with the syntax shown below, it has 2 required parameters and 1 optional parameter:
- url (required):
The URL of the webpage to import data from.
- query (required):
A query that selects the table or list to import. This should be in the form of an XPath or CSS selector.
- 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.
ExamplesHere are a few example use cases that explain how to use the
IMPORTHTMLformula 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
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.
IMPORTHTMLnot working? Here are some common mistakes people make when using the
IMPORTHTMLGoogle Sheets Formula:
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.
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:
IMPORTXMLformula 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.
IMPORTDATAfunction 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'.
IMPORTFEEDfunction 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.
QUERYfunction 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.
You can learn more about the
IMPORTHTML Google Sheets function on Google Support.