1
votes

I'm trying to scrape little data into an excel sheet from Wikipedia website using the ImportXML formula.

The XPath code I copied which I got it from the browser.

Here is the Wikipedia page. https://en.wikipedia.org/wiki/Chicago

Scraping the Latitude and longitude which is present on the page.

Screenshot:

xpath error

This is the code that I get from the browser XPath selector.

//*[@id="mw-content-text"]/div/table[1]/tbody/tr[11]/td/span[1]/span/a/span[1]/span/span[1]

Can you help me with the code and help me where I'm doing the wrong?

1

1 Answers

0
votes

try:

=INDEX(IMPORTXML("https://en.wikipedia.org/wiki/Chicago", "//span[@class='geo-dms']"), 1)

0