In this article:

How Get Data From a Website With Google Sheets (2024 Guide)

May 8, 2024

Can You Get Data From a Website With Google Sheets?

You can scrape website data using Google Sheets through a function called IMPORTXML. This function allows you to fetch data from various structured data types including XML, HTML, CSV, TSV, and RSS and ATOM XML feeds. Here's how you can use it:

Syntax of IMPORTXML:

=IMPORTXML(url, xpath_query)

google sheets get data from website
  • url is the link to the page you want to scrape.
  • xpath_query is the XPath query to navigate through elements and attributes in the HTML document of the page.

How to Get Data From a Website With Google Sheets

Follow the steps below to get data from a website with Google Sheets using the IMPORTXML function.

Step 1: Find the URL

Find the URL of the page you want to scrape.

Step 2: Inspect HTML

Inspect the HTML structure of the page to determine the XPath of the data you want to extract. You can do this by right-clicking on the element in your web browser and selecting “Inspect” or “Inspect Element”.

get data from website google sheets


Use the IMPORTXML function in a cell in Google Sheets with the URL of the page and the XPath query you want to use.

For example, if you want to scrape a list of items from a webpage, you might use a formula like this:

=IMPORTXML("", "//div[@class='item']")

Some important points to remember:

  • The website must allow access to Google Sheets; some sites might block requests from Google Sheets.
  • The data must be in a structured format that is compatible with XPath queries.
  • IMPORTXML has a limit on the number of calls you can make per spreadsheet.
  • Websites with dynamic content loaded by JavaScript might not return the expected results because IMPORTXML does not execute JavaScript.

For detailed instructions, you can read our guide on how to use the IMPORTXML function.

Remember, it's essential to use web scraping responsibly and follow the terms of service or robots.txt file of the website you're scraping from. Always ensure that your activities are legal and ethical.

We hope that this article has helped you and given you a better understanding of how to get data from a website with Google Sheets. If you enjoyed this article, you might also like our articles on how to enable smooth scrolling in Google Sheets and how to center text in Google Sheets.

Get Google Sheets productivity and automation tips delivered straight to your inbox
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
We'll email you 1-3 times a week — and never share your information.
Get your copy of our free Google Sheets automation guide!
  • 27 pages of Google Sheets tips and tricks to save time
  • Covers pivot tables and other advanced topics
  • 100% free

Work less, automate more!

Use Lido to connect your spreadsheets to email, Slack, calendars, and more to automate data transfers and eliminate manual copying and pasting. View all use cases ->