Google Sheets ImportXML: How to Use ImportXML With Examples

Google Sheets Importxml

There are millions of users from the world that use Google Sheets daily but, they are not aware of all the functions that Google Spreadsheet have. From those functions, ImportXML is a very unique function that we will discuss in this blog. So first, we should understand what is ImportXML function and what we can do with this function?

What is the Google Sheets ImportXML Function?

It is the pre-built function of Google Sheets that used to retrieve data in the structured data. It has two parameters, first is URL and second is XPath query. In the first parameter, you have to provide the URL in the double quotes and in a second parameter, you have to add XPath query in double quotes.


Syntax of ImportXML

=IMPORTXML(url, xpath_query)

How to Use Google Sheets ImportXML?

You can use this function to extract any piece of information available publicly. Like Wikipedia Page or any other web page.

Google Sheets ImportXML Examples

1. Extract Page Title From URLs Using ImportXML

Suppose, If you have a situation where you need a Page TItle of multiple URLs, so how long will run this task? I think it will take ⅓ of your whole day 🙂

To overcome this situation, you can use ImportXML function. Have a look at the brief example below:

Examples of URLs:

http://www.countingcharacters.com
http://www.countingcharacters.com/google-serp-tool
http://www.countingcharacters.com/image-compressor-online

=IMPORTXML("http://www.countingcharacters.com" , "//title")

Or, you can also refer a cell in the first parameter

=IMPORTXML(A1,"//title")

Output: Online Character, Letter & Word Count Tool – Counting Characters

2. Extract H1 Tag

To extract H1 tag content, you have to follow the same procedure as discussed above

=IMPORTXML("http://www.countingcharacters.com" , "//h1")

Output: Character and Word Count Tool Online

To explore more examples, click on the below button and make a copy of Google Spreadsheet that has lots of ImportXML examples.

Leave a Reply

Your email address will not be published. Required fields are marked *