xmlgoogle-chromexpathgoogle-sheetsxml-import

IMPORTXML Error on Google Sheets


I want to import the following table onto Google Sheets and schedule it to refresh once a week. I am just starting messing around with XPath, and was able to find that I will need to have the Relative XPath in the IMPORTXML formula for this to work. I used the 'XPath Helper' Chrome addon to find the same, but I am getting the "Could not fetch URL" error.

=IMPORTXML("www.bloomberg.com/billionaires/", "/html[@class='no-js']/body/div[@class='dvz-content'][1]/section[@class='container-width']/div[@class='table-chart']/div[@class='table-row'][1]/div[@class='table-cell t-name']/a")

Any help is appreciated to get me started?

Thanks!


Solution

  • Two things - one is that the URL your requesting is missing the http:// protocol, which is required in order for importxml to work - second here is an xpath that works (the one you were using wasnt working) and this one is much simpler -

    Here is the full formula:

    =IMPORTXML("http://www.bloomberg.com/billionaires/", "//*[@class='table-row']")

    enter image description here