1

This has been covered elsewhere (here and here), but I'm having trouble in my specific situation getting an XPath to work correctly in a Google Sheets using =importxml

I'm trying to scrape some data from this site: http://quicktake.morningstar.com/fundnet/printreport.aspx?symbol=PRHSX

I used the Chrome extension XPath Helper Which gave me this XPath: html/body/table[2]/tbody/tr[14]/td/table[5]/tbody/tr[2]/td[2]

I tried removing /tbody as others suggested but Google Sheets still returns N/A

What is wrong with this code (in Google Sheets)?

=IMPORTXML("http://quicktake.morningstar.com/fundnet/printreport.aspx?symbol=PRHSX", "html/body/table[2]/tbody/tr[14]/td/table[5]/tbody/tr[2]/td[2]")

I'm trying to grab the -28.8 under the "Performance History" heading (the total % return for 2008).

Community
  • 1
  • 1
Nathan
  • 1,483
  • 3
  • 18
  • 41

1 Answers1

0

This works. =INDEX(IMPORTHTML("http://quicktake.morningstar.com/fundnet/printreport.aspx?symbol=PRHSX", "table",13),2,2)

Ed Nelson
  • 10,015
  • 2
  • 27
  • 29
  • Thanks, yes this does work. The issue is for me this takes much longer to figure out (there are no helper tools, it is just trial and error to find which table the data is in). I really would like to use a Xpath because it would be so much faster. – Nathan May 10 '15 at 15:07