xpath to get URLs in Google sheet from XML

Viewed 98

I am trying to import all the URLs from this page in a Google Sheet.

The formula I am using is

=IMPORTXML("https://www.mangoblogger.com/wp-sitemap-posts-page- 1.xml","//*[@id=""sitemap__table""]/tbody/tr/td/a")

But I am getting an error. I tried multiple variations of xpath (/a,tbody/tr etc), but no luck.

What would be the xpath to use in the formula to bring in all the URLs from given URL?

P:S - This XML URL is auto-generated by Wordpress.

1 Answers

I think that when I saw the data from the URL of https://www.mangoblogger.com/wp-sitemap-posts-post-1.xml, I confirmed that the data is the XML data. So, how about the following xpath?

Sample xpath:

//*[local-name()='loc']

Sample formula:

=IMPORTXML("https://www.mangoblogger.com/wp-sitemap-posts-post-1.xml","//*[local-name()='loc']")

Result:

enter image description here

Reference:

Related