How to scrape data into Google Sheets

In short: Scrape data from a website to Google Sheets with the built-in IMPORTHTML (for tables and lists) and IMPORTXML (for single elements by XPath) when the data is in the page's HTML. When the formulas return nothing, usually because the page draws its data with JavaScript, extract it with a browser tool and import the CSV.
Method 1 — IMPORTHTML for tables and lists
IMPORTHTML grabs a specific table or list from a page by its position. The syntax is:
=IMPORTHTML("https://example.com/page", "table", 1)
- Open your sheet and click an empty cell.
- Type the formula with the page URL.
- Set the second argument to
"table"or"list". - The third argument is the index —
1for the first table,2for the second, and so on. If you get the wrong data, increment the number until you find your table.
The data lands live and refreshes periodically, which is great for something like a currency table or a leaderboard you want to keep an eye on.
Method 2 — IMPORTXML for specific elements
When you need one field rather than a whole table — a price, a title, a rating — IMPORTXML targets elements with an XPath query (XPath is the W3C language for selecting parts of a document):
=IMPORTXML("https://example.com/product", "//span[@class='price']")
To find the XPath, right-click the element in your browser, choose Inspect, then right-click the highlighted node and choose Copy > Copy XPath. Paste it as the second argument, changing any double quotes inside the XPath to single quotes so the formula stays valid. It is powerful but brittle: when the site changes its markup, the formula breaks and you have to fix the XPath.
When the formulas return nothing
Sooner or later you will hit a page where IMPORTHTML and IMPORTXML return an error, #N/A, or an empty cell. The usual reasons:
- JavaScript rendering. Google fetches the raw HTML; if the data is drawn by scripts after load, it simply is not there for the formula to see. This is the most common cause on modern sites.
- Login or paywall. The content sits behind authentication the formula cannot pass.
- Blocking. Some sites refuse Google's fetcher.
- Wrong index or XPath. Fixable — adjust and retry.

Method 3 — Extract, then import (when formulas fail)
When formulas cannot reach the data, extract it from the rendered page with a browser tool and bring the result into Google Sheets. ScrapeSheet reads the page you have open as your browser displays it, so it can also see content that scripts add after loading, and it exports to CSV or the clipboard, which Google Sheets imports cleanly.
- Install ScrapeSheet from the Chrome Web Store and open the page you want.
- Click the icon, then Extract; describe the columns in plain language if the page is messy (Pro, with your own Claude or OpenAI key).
- Copy the result to the clipboard and paste it into a sheet, or export it as a CSV file.
- For CSV, in Google Sheets use File > Import > Upload and pick "Insert new sheet(s)" or "Replace data at selected cell".
With Pro, this also handles data spread across many pages — see scraping multiple pages — so you can gather a full list and drop it into one tab. The free plan allows up to 20 rows per export and one page per run; ScrapeSheet Pro (€12.99 per month) removes both limits.
Which method to choose
- Static HTML table you want live:
IMPORTHTML. - A single field from a static page:
IMPORTXML. - JavaScript pages or many pages: extract with ScrapeSheet and import.
If your data really lives in Excel rather than Google Sheets, the same extract-and-export idea applies — see how to scrape a website to Excel. More guides are on the ScrapeSheet blog.
FAQ
Can Google Sheets scrape a website?
Yes, with built-in functions. IMPORTHTML pulls a table or list by index, and IMPORTXML extracts elements with an XPath query. They work on static HTML but not on content that loads via JavaScript.
Why does IMPORTHTML return an error or nothing?
Common causes: the page renders its data with JavaScript, the table index is wrong, the site blocks Google's fetcher, or the content is behind a login. In those cases, extract with a browser tool and import the CSV instead.
How do I scrape a JavaScript page into Google Sheets?
Use a browser extension like ScrapeSheet to extract the rendered data to CSV, then use File > Import in Google Sheets, or paste it from the clipboard.
Sources
General information, not legal advice. Always check the website's terms and the data-protection rules that apply to you.