How to Import Data from Website to Google Sheets: 3 Methods
Importing website data into Google Sheets can save hours of manual data entry. Google Sheets includes built-in functions like IMPORTHTML and IMPORTXML that pull data directly from web pages. For more complex scenarios, browser extensions offer a flexible alternative. This guide covers three proven methods with practical examples to help you choose the right approach for your needs.
Best for Simple Tables and ListsIMPORTHTML
The IMPORTHTML function extracts table or list data directly from web pages. It's the simplest way to import website data into Google Sheets and requires no coding knowledge. Just provide a URL and specify whether you want a table or list.
How IMPORTHTML Works
The formula syntax is straightforward:
=IMPORTHTML(url, query, index)- url: The webpage URL in quotes
- query: Either "table" or "list"
- index: Which table or list to import (1 for the first one, 2 for the second, etc.)
Example: Import Stock Data
Let's import a table from Wikipedia. This example pulls the list of S&P 500 companies:
=IMPORTHTML("https://en.wikipedia.org/wiki/List_of_S%26P_500_companies", "table", 1)This formula imports the first table from the Wikipedia page. The data updates automatically when you refresh the sheet. According to Google's IMPORTHTML documentation, the function refreshes every hour by default.
Important Limitation
IMPORTHTML only works with static HTML. If you see blank cells or missing data, the website probably uses JavaScript to render content. Modern single-page applications (SPAs) built with React, Vue, or Angular won't work with this function. For those sites, skip to the Chrome extension method below.
Pros
- No coding required
- Data updates automatically
- Works directly in Google Sheets
- Perfect for structured HTML tables
Cons
- Only works with static HTML content
- Cannot scrape JavaScript-rendered sites
- Limited control over data selection
Best for Advanced Data ExtractionIMPORTXML
IMPORTXML gives you precise control over what data to extract using XPath queries. While it requires more technical knowledge than IMPORTHTML, it's far more flexible. You can target specific elements, extract attributes, and combine multiple data points from different parts of a page.
Understanding the Syntax
=IMPORTXML(url, xpath_query)- url: The webpage URL in quotes
- xpath_query: An XPath expression that specifies which elements to extract
Finding XPath with DevTools
Here's how to get the XPath for any element on a webpage:
- Open the webpage in Chrome or Firefox
- Right-click the element you want to scrape and select "Inspect"
- In the developer tools, right-click the highlighted HTML element
- Select Copy → Copy XPath (or Copy full XPath)
You can learn more about XPath syntax in the MDN Web Docs XPath guide.
Example: Extract Product Prices
Let's extract all product prices from a webpage. This example uses a common CSS class name:
=IMPORTXML("https://example.com/products", "//span[@class='price']")This XPath query finds all <span> elements with the class "price" and returns their text content. The results appear in a vertical column starting from the cell where you enter the formula.
Example: Extract Multiple Columns
To extract both product names and prices, use separate formulas:
// In column A (product names):
=IMPORTXML("https://example.com/products", "//h2[@class='product-name']")
// In column B (prices):
=IMPORTXML("https://example.com/products", "//span[@class='price']")JavaScript Limitation
Like IMPORTHTML, IMPORTXML cannot access content rendered by JavaScript. It reads the raw HTML response from the server. If a website loads data dynamically after the page loads, IMPORTXML won't see it. Test the formula first, and if you get blank results, the site likely requires the Chrome extension method.
Pros
- Precise control over data extraction
- Can target specific elements
- Handles complex HTML structures
- Updates automatically like IMPORTHTML
Cons
- Requires XPath knowledge
- Doesn't work with JavaScript-rendered content
- XPath can break if site structure changes
Best for One-Time ExtractionChrome Extension
The Parsea Chrome extension solves the JavaScript rendering problem for tables. It captures what you actually see on screen, regardless of how the page was built. This makes it perfect for modern web applications, dashboards, and any site where IMPORTHTML and IMPORTXML fail.
Auto Capture Feature
The extension's auto capture feature automatically detects tables on any webpage. Just click the extension icon, and it extract all tables from the page. The data is instantly ready to copy into Google Sheets.
How to Use It
- Install the Parsea extension from the Chrome Web Store
- Navigate to the webpage with data
- Click the Parsea icon in your browser toolbar
- Click the Auto Capture button
- Copy the results and paste into Google Sheets
You can also download results as CSV or email them directly. The extension works with any visible content, including data rendered by React, Vue, Angular, or any JavaScript framework.
Bonus: Extract Tables from Images and PDFs
Beyond web scraping, the manual capture mode lets you extract tables from images and PDF documents displayed in your browser.
Pros
- Works with JavaScript-rendered content
- No technical knowledge required
- Extracts from images and PDFs
- Free to use with no sign-up
Cons
- Requires browser extension installation
- Cells won't update automatically
Which Method Should You Choose?
Each method serves different needs. Here's a quick comparison:
| Method | Best For | Works with JS | Auto Updates |
|---|---|---|---|
| IMPORTHTML | Simple tables, static sites | No | Yes |
| IMPORTXML | Specific elements, advanced scraping | No | Yes |
| Chrome Extension | Modern sites, one-time extractions | Yes | No |
Use IMPORTHTML when you need data from static websites with clear table structures. It's perfect for news sites, Wikipedia, and traditional web pages that don't rely on JavaScript.
Use IMPORTXML when you need to extract specific elements or when IMPORTHTML doesn't give you enough control. It's ideal for scraping prices, product names, or any targeted data from static pages.
Use the Chrome extension when dealing with modern web applications, dashboards, or any site where the built-in functions return blank results. It's also your only option for extracting tables from images and PDFs.
Final Thoughts
Importing data into Google Sheets doesn't have to be complicated. Start with IMPORTHTML for simple tables, move to IMPORTXML when you need more control, and use browser extensions when working with modern websites that rely on JavaScript.
Each method has trade-offs. Built-in functions offer automatic updates but can't handle dynamic content. Browser extensions work with any visible content but require manual extraction. Choose based on whether you need live data or one-time extraction, and whether the source website uses JavaScript rendering.