Prompt
How do I scrape data from a website into Google Sheets?
Latest observation
Oct 13, 2026
OpenAI APIWeb search: off
You can scrape website data into Google Sheets in a few common ways, depending on how the site is built and how much automation you want.
1) Use Google Sheets formulas for simple pages
If the site is publicly accessible and the data is in the HTML source, you can try:
=IMPORTHTML(url, "table", index)=IMPORTXML(url, xpath_query)=IMPORTFEED(url)
Examples
=IMPORTHTML("https://example.com", "table", 1)
=IMPORTXML("https://example.com", "//h1")
Limitations
- Works only on pages where the data is present in the HTML
- Often fails on JavaScript-rendered sites
- Some sites block Google Sheets requests
- XPath can be tricky
2) Use Apps Script for more control
Google Apps Script lets you fetch a page, parse it, and write results into your sheet.
Basic example
- In Google Sheets, go to Extensions > Apps Script
- Paste this:
function scrapeExample() {
const url = "https://example.com";
const html = UrlFetchApp.fetch(url).getContentText();
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
sheet.clear();
// Very simple regex example (not robust)
const matches = html.match(/<h1[^>]*>(.*?)<\/h1>/i);
sheet.getRange("A1").setValue(matches ? matches[1] : "No match found");
}
Better for structured HTML
Use parsing libraries or extract data with regex carefully.
Good for
- Scheduled scraping
- Writing multiple rows/columns
- Combining data from several pages
3) Use a scraping tool or API + import into Sheets
If the website offers an API, that’s usually the best option.
Common approaches
- Use
IMPORTDATAfor CSV/TSV files - Use
IMPORTJSONvia Apps Script for JSON APIs - Use third-party connectors like:
- Apify
- ParseHub
- Octoparse
- Browse AI
- Coupler.io
- Sheetgo
These tools often let you scrape and sync results directly to Google Sheets.
4) Use Python or another external script
If the site is more complex, scrape it externally and push results to Sheets via the Google Sheets API.
Typical stack:
- Python +
requests+BeautifulSouporSelenium - Google Sheets API or
gspreadto write data
This is best for:
- JavaScript-heavy sites
- Login-required sites
- Larger datasets
- More reliable automation
Important notes
- Check the website’s Terms of Service and robots.txt
- Don’t scrape personal, copyrighted, or restricted data without permission
- Add delays and avoid hammering the site
- Prefer APIs if available
Which method should you use?
- Simple static page:
IMPORTHTML/IMPORTXML - Medium complexity: Google Apps Script
- JavaScript-heavy or login-required: Python + browser automation
- Need no-code: third-party scraper tool
If you want, I can show you:
- a formula-based example,
- a Google Apps Script scraper, or
- a Python script that sends data to Google Sheets.