importxml google spreadsheet - “xml content cannot be parsed” error in NEW Google Sheets

感情迁移 提交于 2019-12-07 23:44:41

问题


I was trying to get few details from a link on google spreadsheet.

Link: http://www.justdial.com/Gurgaon/Travel-Agents/ct-302

I want to extract all the four lines i.e. name, phone no, address and category of each block.

I ran the following query to extract the name but it was not working.

importxml(url, "//span[@class='jcn']/a")

Error = "imported xml content cannot be parsed"

Please help.


回答1:


EDIT: Please note, that as of 18/06/2015 this error no longer appears in New Sheets! Looks like google fixed it! ;)


ORIGINAL ANSWER:

This has proved to be an interesting one...
I cannot explain why - the odd bahaviours in google sheets have baffled me for a while...

I have tested this, and your IMPORTXML() formula returns en error, as described by you on google sheets using the "New Google Sheets", but not on sheets that have been created using the "old sheets"

How to tell if a sheet is "old" or "new":

New sheets have (when opened)

  • a green tick on the bottom of the screen
  • a green "sheet" icon on the tab / window title bar (favicon)
  • a "Add-ons" menu item on the main toolbar between "Tools" and "Help"

Old sheets have (when opened)

  • no tick
  • a 3-coloured "drive" triangle icon on the tab / window title bar (favicon)
  • no "Add-ons" menu item

How do you create an Old-Sheet? - Click g.co/oldsheets (here is the original google help article)

Once you've done that, write your IMPORTXML() function exactly as you described



来源:https://stackoverflow.com/questions/26382920/importxml-google-spreadsheet-xml-content-cannot-be-parsed-error-in-new-googl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!