Mario Di Marcantonio
Mario Di Marcantonio

Reputation: 21

Import table using IMPORTXML xpath

I am trying to import a table from the following website http://financials.morningstar.com/valuation/price-ratio.html?t=MOS&region=usa&culture=en-US using google spreadsheet function ImportXML, I have problems with the xpath I found this one for for the table I am looking for: //*[@id="valuation_history_table"].

and I am using this formula=importXML(A4,"//*[@id="valuation_history_table"]")

but I get the following error msg:

Error
Formula parse error.

Could you please help me?

Upvotes: 2

Views: 6636

Answers (1)

Aurielle Perlmann
Aurielle Perlmann

Reputation: 5529

Your getting a formula parse error because you used double quotes in your xpath - also you wouldnt be able to pull it in anyway - if you want a much lighter , less complicated endpoint use this url instead (all the parameters are basically the same) but you can use xpath //tr and get the whole table

 =IMPORTXML("http://financials.morningstar.com/valuate/valuation-history.action?&t=XNYS:MOS&region=usa&culture=en-US&cur=&type=price-earnings","//tr")

enter image description here

Upvotes: 2

Related Questions