How to scrape data into Google Sheets
Google Sheets can pull data straight off the web without a single add-on — for the right kind of page. When the built-in functions can reach the data, they are the fastest option; when they cannot, you extract with a browser tool and import. Here is both paths, and how to tell which one you need.
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:
=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 Copy > Copy XPath. Paste it as the second argument. It is powerful but brittle: when the site changes its markup, the formula breaks and you 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 (works on any page)
When formulas cannot reach the data, extract it from the rendered page with a browser tool and bring the result into Sheets. ScrapeSheet reads the page you have open — including JavaScript content and logged-in views — and 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.
- Choose Copy to clipboard and paste into a sheet, or Export to CSV.
- For CSV, in Google Sheets use File > Import > Upload and pick "Insert new sheet(s)" or "Replace data at selected cell".
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.
Which method to choose
- Static HTML table you want live:
IMPORTHTML. - A single field from a static page:
IMPORTXML. - JavaScript pages, logins, or many pages: extract with ScrapeSheet and import.
If your data really lives in Excel rather than Sheets, the same extract-and-export idea applies — see how to scrape a website to Excel.
FAQ
Can Google Sheets scrape a website?
Yes. IMPORTHTML pulls a table or list by index; IMPORTXML extracts elements by XPath. Both work on static HTML but not on JavaScript-rendered content.
Why does IMPORTHTML return an error or nothing?
Usually JavaScript rendering, a wrong index, a blocked fetcher, or login-gated content. Then extract with a browser tool and import the CSV.
How do I scrape a JavaScript page into Sheets?
Use ScrapeSheet to extract the rendered data to CSV, then File > Import, or paste from the clipboard.