Vasim
Vasim

Reputation: 3143

Identify exact XPath for ImportXML in Gsheet

I want to scrape 52 Week low price (which is 238.00 for today) from this website in Google Spreadsheet. I'm using the =IMPORTXML function.

To get Xpath, I'm using XPath Helper Chrome extension which gives me the following path:

/html/body/center[2]/div/div/div[8]/div[@id='nChrtPrc']/div[@id='content_full']/div[@id='content_bse']/div[@class='PT10 clearfix']/div[@class='FR']/div[@class='PB3 gD_11'][2]/span[@id='b_52low']

I tried using

=IMPORTXML(A1,A2)

Where, A1 = URL and A2 = //span[@id='b_52low']

But not getting the desired result, any help on exact XPath please.

Upvotes: 0

Views: 561

Answers (2)

Aurielle Perlmann
Aurielle Perlmann

Reputation: 5509

This xpath worked for me no problem:

=IMPORTXML("http://www.moneycontrol.com/india/stockpricequote/media-entertainment/erosinternationalmedia/EIM","//*[@id='b_52low']")

Upvotes: 1

Igor Savinkin
Igor Savinkin

Reputation: 6277

You need to rightly do with quoting:

=IMPORTXML("<url>", "//span[@id='b_52low']")

Check that you do not misuse " (double quotes) twice (for id name and xPath boundaries).

There might be invadlid HTML, and IMPORTXML therefore can't read/parse it.

Upvotes: 0

Related Questions