Reputation: 15
I want to import urls from https://www.mastersportal.com/ranking-country/82/united-states.html to get all the links of best universities in USA.
However, when I use the importXML formula, like importXML("url", "//td[@class='OrganisationListing']/@href"), it doesn't work.
What should I do to fetch the links with google sheet import formula?
Thanks in advance.
Upvotes: 1
Views: 685
Reputation: 201378
I believe your goal as follows.
https://www.mastersportal.com/ranking-country/82/united-states.html
.In this answer, //td[@data-title='Universities']/a/@href
is used as the xpath.
=IMPORTXML("https://www.mastersportal.com/ranking-country/82/united-states.html","//td[@data-title='Universities']/a/@href")
In the current stage, it seems that 258 hyperlinks are retrieved.
Upvotes: 2
Reputation: 11268
This will help:
=importXML("https://www.mastersportal.com/ranking-country/82/united-states.html", "//table//tr//a/@href")
Upvotes: 1