This function seems to work in general, but in this case:
XPATH: //*[@id='leftTable']/table[1]/tbody/tr[23]/td[2] (although it doesn't work with any XPATH).
I get the error
Error: Imported XML content cannot be parsed. I think the problem is with the page itself, but I cannot see what Google is seeing (or can I?) Any pointers would be much appreciated.
42 Answers
Incredibly odd, but the general solution for problems regarding the IMPORTXML function in the new version of Google Sheets is - use the older version.
There, if the following formula is used in a cell:
=IMPORTXML("","//*[@id='leftTable']/table[1]/tbody/tr[23]/td[2]") The displayed result is:
8.10p Which is correct, I assume.
4Most ImportXML errors today are because the page is using Javascript.
If you use Developer Tools and inspect the site in Chrome, you find the HTML which was rendered into the DOM by the Javascript. BUT if you look at the the page source, you won't find the data.
Google Sheets doesn't act as a client browser so there is nowhere for the JS to execute.
This is why the copied XML path from Inspect Element into Google Sheets IMPORTXML errors out.