0
votes

I'm having great difficulty trying to retrieve the result I'm looking for when I have an xpath using importxml on a google sheet.

I'm not sure If I'm doing it right or is the xpath to long for the result to be retrieved.

This is what I'm doing

I'm trying to retrieve the winloss data of a tennis player

http://www.tennisabstract.com/cgi-bin/wplayer.cgi?p=TimeaBacsinszky

URL Cell a1 Xpath Cell a4 Formula cell a6

Formula is as so =IMPORTXML(A1,A4)

When I use xpath helper plug in to get the xpath the result shown is correct 32-23 (58%)

but when i paste in the xpath I get "imported content is empty.

the xpath is

/html/body/div[@id='header']/table/tbody/tr[3]/td[@id='wonloss']/table[@id='overall']/tbody[@id='splitsbody']/tr[@id='s']/td[2]

Using xpath helper it tells me this xpath is getting the result I'm looking for but google sheets isn't retriving the query

Am I missing something or is the xpath query too complex?

1

1 Answers

0
votes

I think the problem comes from the fact that the content in your web page is generated in javascript, so even if you used something more simple like :

=IMPORTXML("http://www.tennisabstract.com/cgi-bin/wplayer.cgi?p=TimeaBacsinszky",".//*[@id='s']/td[2]/text()")

and got the content inside the cell, it still wouldn't work.