Last Updated on October 31, 2023 by Jake Sheridan
In this tutorial, you will learn how to use importxml in Google Sheets.
How To Use IMPORTXML in Google Sheets
If you’re looking for a way to import data from the web into a Google Sheet, one tool you might consider is the IMPORTXML function. While it may sound intimidating at first, it’s actually quite easy to use.
The IMPORTXML function uses the XQuery language to extract particular information from a webpage. Whether you’re looking for stock prices, weather information, or news headlines, you can use IMPORTXML to scrape the data you need.
In this guide, we will show you how to use IMPORTXML in Google Sheets.
How to Import from an XML File in Google Sheets
Here’s our step-by-step guide on how to import from an xml file in Google Sheets.
Step 1
First, select an empty cell and type the IMPORTXML function.

Step 2
In the first argument, type the URL of the page you want to examine. Next, provide the xpath_query to run.

In this example, we want our IMPORTXML file to output all the href elements found in the URL “https://google.com”.
Step 3
Hit the Enter key to evaluate the IMPORTXML function.

The formula should return each result of the XPath query in a separate line.
Step 4
The IMPORTXML function is quite powerful since it can run a variety of XPath queries.

For example, we can use the “//title” query to return the title of the web page. The title tag defines the title of the document which is what is shown in the browser’s title bar.

We can use the “//h1” query to find the H1 heading found in a URL containing an article or blog post. This is useful if you need to return the main topic of a web page.
Summary
This guide should be everything you need to learn how to use importxml in Google Sheets.
Click this link to make a copy of this sample document to try doing it yourself!
More ways to import in Google Sheets:
- IMPORTHTML
- IMPORTFEED
- IMPORTDATA
- IMPORTJSON
- Fix IMPORTRANGE Internal Error
- IMPORTRANGE From Another Tab
- IMPORTRANGE With Conditions
- IMPORTRANGE With Formatting
- VLOOKUP + IMPORTRANGE
- IMPORTRANGE Multiple Ranges
- Filter IMPORTRANGE Data
- Fix IMPORTRANGE Error Loading Data
- Fix IMPORTRANGE Formula Parse Error
- Open CSV File
- Create A CSV File
- Import Data Into Google Sheets
- Import Spreadsheet Into Google Sheets
- Export Google Sheets To Excel
- Download Google Sheets
- How To Use Importrange
- Import CSV
- Import Excel
- Save as a CSV
- Import Data From Another Sheet
- Import Google Sheets To Excel
- Import PDF
- Export a Google Sheet into Different Formats
- Pull Data From Multiple Tabs
- Connect Google Forms To Google Sheets
- Open Excel In Google Sheets