IMPORTXML – how to use in Google Sheets

Learn how to use IMPORTXML formulas in Google Sheets in this simple step-by-step tutorial.

How to download data from the Internet with the help of Google Sheets?

Do you want to copy a table from any website, or maybe you want to quickly retrieve on-page SEO elements such as headings, meta title or description from your competitors?

The IMPORTXML function will help you automate such activities.

What is IMPORTXML?

The syntax of the IMPORTXML function is:

=IMPORTXML(url; xpath_query)

The IMPORTXML function allows you to import data from various structured data types, such as:

  • XML,
  • HTML,
  • CSV,
  • TSV,
  • RSS feeds,
  • ATOM XML.

The function retrieves data from any XML field, which means any field enclosed in HTML tags, such as

,

etc.

You can use the IMPORTXML function to import publicly available information from the websites. This means that inaccessible information will remain on pages to which you must log in (such as internal systems).

How to use IMPORTXML for SEO?

You can successfully use the IMPORTXML function, among others: for collecting metadata on websites, such as H1 headings, meta title, description or internal links.

For more useful information about SEO, visit Monster SEO Agency.

How to use the IMPORTXML in Google Sheet?

First, let’s explain what the IMPORTXML function consists of.

URL:

  • This argument is responsible for the URL of the page from which we want to retrieve data,
  • includes the protocol (http:// or https://),
  • The value for the URL must be enclosed in quotation marks or be a reference to another cell where the address is located,

XPath query:

  • each result of an XPath query is placed in the cell where the function is located,
  • XPath is a query language used to retrieve snippets of information from Web pages,
  • XPath has its own syntax, you can found more details in the documentation.

To use XPath, you need to understand the basics of HTML.

The data on the website is displayed using HTML and is stored in XML format.

XPath is the language used to query this data stored in XML format.

Related posts