Google表格上的IMPORTXML错误

时间:2017-06-15 04:03:59

标签: xml google-chrome xpath google-sheets xml-import

我想将以下table导入Google表格并安排每周刷新一次。我刚刚开始搞乱XPath,并且能够发现我需要在IMPORTXML公式中使用相对XPath来实现此功能。我使用了' XPath Helper' Chrome插件可以找到相同的内容,但是我得到了"无法获取网址"错误。

=IMPORTXML("www.bloomberg.com/billionaires/", "/html[@class='no-js']/body/div[@class='dvz-content'][1]/section[@class='container-width']/div[@class='table-chart']/div[@class='table-row'][1]/div[@class='table-cell t-name']/a")

感谢任何帮助让我开始?

谢谢!

1 个答案:

答案 0 :(得分:0)

两件事 - 一个是你请求的URL缺少http://协议,这是importxml工作所必需的 - 第二个是一个有效的xpath(你使用的那个不工作)和这个更简单 -

以下是完整的公式:

=IMPORTXML("http://www.bloomberg.com/billionaires/", "//*[@class='table-row']")

enter image description here