Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

ImportXML lets you get information from filetypes such as xml, html, csv, tsv, as well as RSS and Atom feeds.

This example in Google Docs Help for importXml function -

=importXml("toysrus.com";; "//a/@href") 

... fails with this message -

error: The xPath query given could not be evaluated. Please check the syntax of the query: //a/@href

There are 2 other cases where they ran well earlier but now fail. The function scrapes well in this case.

Are there any changes in the way ImportXML function works in Google Docs Spreadsheet that makes it fail in some cases?

share|improve this question
1  
Do you still face those problems? Was the answer of @Siva sufficient? Please give us some feedback. –  Jacob Jan Tuinstra Jan 20 '13 at 12:47

1 Answer 1

error: The xPath query given could not be evaluated. Please check the syntax of the query: //a/@href

The Error message says XPath could not be evaluated.

Here the problem is: you need to provide / target with proper XPath to retrieve the value.

Refer my sample XPath for this:-

=importXml("http://www.toysrus.com", "/html/body/div[@id='hdrWrapper']/div/div/ul/li/a/@href")

UPDATED:

Your requested formula will be as mentioned below:-

=ImportXML("http://www.thefreedictionary.com/p/taciturn", "//div[@class='ds-single']")
share|improve this answer
    
Thanks, that works but isn't it surprising that the official sample doesn't work –  mvark Feb 12 '12 at 6:44
    
Thanks, that works but isn't it surprising that the sample in the official docs doesn't work. Has the syntax changed or are their new rules for it to work? How should I frame the query to get the meaning of a word from thefreedictionary.com. This is what I tried =ImportXML("thefreedictionary.com/p/taciturn","/html/body/div/…) –  mvark Feb 12 '12 at 6:51
    
@mvark: I have updated my answer. Refer it. –  Siva Charan Feb 12 '12 at 15:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.