TipsMake
Newest

IMPORTXML function: Automatically retrieves data from a Google Sheets table.

IMPORTXML is a useful data processing function in Google Sheets. Below is how to use IMPORTXML to automate the data import process in Google Sheets .

 

What is IMPORTXML in Google Sheets?

The formula for the IMPORTXML function in Google Sheets is as follows:

=IMPORTXML(url, xpath_query)

The IMPORTXML function imports data from any of the various structured data types, including XML, HTML, CSV, TSV, RSS, and ATOM XML.

It retrieves information from all XML fields. You can use it to import publicly available information on the Internet. Therefore, you are not allowed to use it with websites that require login to access.

When should you use IMPORTXML in Google Sheets?

  1. Extracting data from the web
  2. When you need data on the page but cannot activate Screaming Frog.

 

How to use IMPORTXML in Google Sheets

Before delving into the practical use of IMPORTXML, you need to understand the arguments in the formula:

IMPORTXML function: Automatically retrieves data from a Google Sheets table. Picture 1

URL

  1. This is the URL of the website where you want to import the data.
  2. Includes the protocol (https:// or http://).
  3. The URL value must be included in quotation marks or referenced to a cell containing appropriate text.

XPath Query

  1. XPath queries run on the data of the provided URL.
  2. Each result from an XPath query is placed in its own row in the spreadsheet.
  3. XPath is a query language used to retrieve information from the web.
  4. It has its own syntax, which you can learn more about in online sources.

Things you need to know about XPath:

  1. Data on the web is displayed and stored in XML format.
  2. Data query language.
  3. You can customize Xpath arguments to suit your web search needs.

 

The IMPORTXML function allows you to import data directly from the web into your spreadsheet. Simply look at the web source code at the location where you want to import the data, find the usable HTML element, and extract it using XPath queries.

To find HTML elements, you have to look at the website's code. For example, on a wiki page, right-click on the page and select "View page source" from the menu that appears. When the source page is open, you will see its HTML code. For example, on Wikipedia:

IMPORTXML function: Automatically retrieves data from a Google Sheets table. Picture 2

You may already be familiar with HTML tabs like

,

, … You need to use these tags in xpath_query to import the desired data from the web.

Here's an example of how to use IMPORTXML in Google Sheets:

IMPORTXML function: Automatically retrieves data from a Google Sheets table. Picture 3

 

IMPORTXML function: Automatically retrieves data from a Google Sheets table. Picture 4 IMPORTXML function: Automatically retrieves data from a Google Sheets table. Picture 5

Above are the things you need to know about using IMPORTXML in Google Sheets . Hopefully, this article is helpful to you.

Marvin Fry
Share by Marvin Fry
Update 24 January 2026