Google Sheets intermediate importhtml data-import web-scraping

How to Import HTML Tables or Lists into Google Sheets?

Import HTML Tables and Lists is a Google Sheets function that imports data from a specified table or list on a webpage into google sheets.. Formula Genius generates and validates this formula automatically from a plain-English prompt.

Struggling to get data from a webpage into your spreadsheet? The IMPORTHTML function makes it easy to pull in tables or lists directly.

The Formula

Prompt

"Import a table or list from a webpage directly into Google Sheets using IMPORTHTML"

Google Sheets
=IMPORTHTML(url, query, index)

This formula imports data from a specified table or list on a webpage into Google Sheets.

Step-by-Step Breakdown

  1. url: The web address of the page containing the data.
  2. query: Specify 'table' or 'list' to indicate what type of data to import.
  3. index: The index number of the table or list on the page (1 for the first one).
  4. Ensure the URL is accessible and the data is structured correctly.

Edge Cases & Warnings

  • The webpage is blocked from scraping by robots.txt.
  • The table or list is dynamically generated by JavaScript and not visible in the page source.
  • The specified index does not exist on the page.
  • The URL is incorrect or leads to a 404 error.

Examples

Prompt

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

Google Sheets
Imports the first table from the specified webpage.
Prompt

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

Google Sheets
Imports the second list from the specified webpage.

Frequently Asked Questions

Can I import data from a password-protected site?

No, IMPORTHTML cannot access data behind authentication.

What happens if the webpage structure changes?

The formula may break or return an error if the table or list is no longer in the same format.

Is there a limit to how much data I can import?

Yes, Google Sheets has a limit on the number of cells, which may restrict large imports.

Can't find what you need?

Describe any formula in plain English and Formula Genius will generate, explain, and validate it — instantly.