How to Scrape Data from a Website into Google Sheets

Learn how to scrape data from a website into Google Sheets using IMPORTHTML, IMPORTXML, and Geekflare’s Web Scraping API.

Aakash
Updated October 15, 2026
Share

Collecting website data in a spreadsheet can be tedious when you have to copy each entry manually. Importing that data directly into Google Sheets helps you organize information in one place, analyze it, and share it with others through the cloud.

Google Sheets offers two functions for this task. IMPORTHTML imports tables and lists from web pages, while IMPORTXML extracts specific elements using XPath expressions. Both are useful starting points for simple scraping tasks.

For websites that need more advanced extraction, web scraping APIs offer additional capabilities, such as JavaScript rendering and proxy support.

In this guide, we’ll test both approaches using testingurl.dev. You’ll learn how to import website data using Google Sheets formulas and explore an API-based approach for more complex scraping tasks.

Which Method Should You Use?

There are two ways to scrape website data into Google Sheets. You can use its built-in import functions for simple extraction or connect a web scraping API for more advanced requirements.

1. Google Sheets IMPORT functions

Google Sheets provides two functions for retrieving website data.

  • IMPORTHTML: Retrieves tables and lists from web pages. It works well when the information is organized into HTML tables or lists.
  • IMPORTXML: Extracts specific elements, such as headings, links, and product details, using XPath expressions.

2. Geekflare Web Scraping API

Geekflare’s Web Scraping API extracts website data and supports features such as JavaScript rendering and proxy configuration. These capabilities are useful for pages that load content dynamically or require additional scraping controls.

Geekflare also provides a Google Sheets Website Scraper template to help connect API-based extraction with a spreadsheet.

The following table highlights the main differences to help you choose the right approach.

The following comparison highlights the main differences.

Comparison criteriaGoogle Sheets IMPORT functionsGeekflare Web Scraping API
SetupEnter a formulaConfigure API access and the companion template
Data selectionHTML tables, lists, and elements selected using XPathExtraction based on supported API options
JavaScript renderingLimited when content is absent from accessible HTMLSupports browser rendering
Proxy optionsNo built-in proxy configurationSupports proxy options
Data processingResults populate cells through formulasAPI responses must be mapped to spreadsheet columns
MaintenanceUpdate formulas when page structures changeMaintain the script, API configuration, and field mapping

Scrape Website Data Using Google Sheets IMPORT Functions

Let’s start with a simple example to see how Google Sheets imports website data using its built-in functions.

Import a Table or List with IMPORTHTML

Let’s import a product table from testingurl.dev into Google Sheets.

Step 1: Paste https://testingurl.dev/ into cell A2.

Step 2: Enter this formula in cell B2.

=IMPORTHTML(A2,"list",1)
  • A2 contains the source URL.
  • "list" tells Google Sheets to retrieve an HTML list.
  • 1 selects the first list on the page.

Google Sheets imports the available lists into separate rows. In this example, the homepage returns descriptions of the easyStore home page, category listing, and product detail page.

IMPORTHTML - List

To import the product table instead, use =IMPORTHTML(A2,"table",1) with https://testingurl.dev/scraping/tables/simple in cell A2. Google Sheets retrieves the table with product IDs, names, categories, prices, ratings, and stock quantities, as shown below.

IMPORTHTML - Table

Extract Specific Elements with IMPORTXML

Use IMPORTXML to extract specific elements from a web page instead of importing an entire table or list. It uses XPath expressions to identify the content you want.

Example 1: Extract the page heading

Enter the TestingURL.dev homepage URL in cell A2 and use this formula in B2.

=IMPORTXML(A2,"//h1")

The //h1 expression selects the page’s H1 heading. In this example, Google Sheets returns Developer & Web Scraping Sandbox.

IMPORTXML - h1

Example 2: Extract all H2 headings

To retrieve all H2 headings from the same page, use this formula.

=IMPORTXML(A2,"//h2")

The //h2 expression selects every H2 element and returns the headings in separate rows.

IMPORTXML - h2

These examples show how XPath lets you choose specific elements instead of importing all the content on a page.

Troubleshoot Missing or Incorrect Results

If a formula returns an error or unexpected data, check these common issues.

  • Wrong table or list: Change the index in IMPORTHTML to select the correct table or list.
  • No matching elements: Check the XPath expression in IMPORTXML. For example, //h1 selects H1 headings, while //h2 selects H2 headings.
  • Missing content: Open the source page and check whether the required data exists in its HTML. Content loaded through JavaScript might not be available to these functions.
  • Page access errors: Check whether the URL is correct and the page is publicly accessible.

Google Sheets refreshes imported data approximately every hour while the spreadsheet is open. You cannot force an immediate refresh simply by reopening the document.

If the required content isn’t available to Google Sheets, a web scraping API may offer a more suitable way to retrieve it.

Scrape Website Data with Geekflare and a Google Sheets Template

The import functions have limitations when the required content isn’t available in the page’s HTML. Geekflare’s Web Scraping API provides another way to retrieve that content through a ready-made Google Sheets template.

Copy the Companion Template

Open the Google Sheets Website Scraper template and click Copy the template to create an editable copy in your Google Drive.

Configure API Access

Open your Geekflare dashboard and copy your API key. Return to the spreadsheet and select Website Scraper → Set API key from the menu bar.

Complete the authorization process, grant the requested permissions, and paste your API key into the dialog box.

Add URLs and Define the Fields to Extract

Enter https://testingurl.dev/ in the URL column to test the scraper. You can also specify CSS selectors in the CSS selector column to target particular elements on the page.

The template includes columns for the page title, description, content in Markdown, word count, scraping status, and last scraped time.

Google Sheets Website Scraper template

Run the Scraper and Review the Results

Select Website Scraper → Scrape new rows to process the URL. The template populates the corresponding columns with the extracted information and records the scraping status and timestamp.

Google Sheets Website Scraper Response

You can enter multiple URLs and process them in one run. Review the extracted content and status columns to confirm that the scraper returned the expected information.

Schedule Automatic Updates

The template also supports scheduled scraping. Select Website Scraper → Re-scrape daily at 6 AM to schedule daily runs. Use Re-scrape all rows to refresh existing entries or Stop daily runs to disable the schedule.

These options let you refresh collected website data without manually starting every run.

Frequently Asked Questions

Can I scrape a website into Google Sheets without coding?

Yes. Google Sheets provides IMPORTHTML and IMPORTXML for basic data extraction. You can also use Geekflare’s Google Sheets Website Scraper template to extract website content through its Web Scraping API with minimal coding.

What is the difference between IMPORTHTML and IMPORTXML?

IMPORTHTML imports complete HTML tables or lists from a web page. IMPORTXML uses XPath expressions to extract specific elements, such as headings and links.

Why is my import formula returning no data?

Check the source URL, table index, and XPath expression. The required content must also be accessible to Google Sheets. Pages that load data through JavaScript may require a web scraping API with rendering support.

How can I refresh imported data automatically?

Google Sheets checks IMPORTHTML and IMPORTXML results for updates approximately every hour while the spreadsheet is open. For scheduled scraping, Geekflare’s template provides a daily run option that you can enable from the Website Scraper menu.

Conclusion

Google Sheets’ built-in import functions are a practical starting point for extracting tables, lists, and individual elements from accessible web pages. They require little setup and work directly within your spreadsheet.

For more advanced extraction, Geekflare’s Web Scraping API and Google Sheets Website Scraper template provide additional capabilities, such as JavaScript rendering, CSS selector-based extraction, and scheduled scraping.

Choose the method that fits your data source and extraction needs.

Aakash
Aakash R
Developer Advocate

Aakash R is a Developer Advocate with expertise in Artificial Intelligence, Machine Learning, and Computer Vision. Alongside his work in developer advocacy, he actively contributes technical articles and research-driven content on Generative AI, AI agents, developer tools, and cloud platforms. He enjoys translating advanced AI concepts into practical resources that developers can apply in real projects.

Thanks to Our Partners

More from Geekflare

2-Web-Scraping-MCP-Servers
Data & Web Scraping
12 Web Scraping MCP Servers Developers Should Know in 2026

Compare 12 web scraping MCP servers in 2026, with features, pricing, setup options, and use cases…

Data & Web Scraping
Aurorium Browser Review 2026: AI Fingerprints and Pricing

An analysis of Aurorium Browser’s AI fingerprinting, CRM, and pricing to help you determine if it…

Metadata Extraction vs Full-Page Scraping
Data & Web Scraping
Metadata Extraction Vs. Full-Page Scraping

Metadata Extraction vs Full-Page Scraping compares the data each method extracts, their use cases, and how…