如何在Google表格中获取亚马逊价格信息?

时间:2014-09-05 06:41:16

标签: xml web-scraping google-sheets amazon formulas

在旧版Google电子表格中,可以使用以下公式完成此操作:

=value(importXml("http://www.amazon.com/<your url here>", "//b[@class='priceLarge']"))

但是,在新版Google电子表格中,这不起作用

现在怎么做?

2 个答案:

答案 0 :(得分:1)

这对我有用:

= IMPORTXML(超链接(串连(&#34; AMAZON_URL_HERE&#34;)),&#34; // * [@ id中=&#39; priceblock_ourprice&#39;]&#34)

答案 1 :(得分:1)

你必须用a替换;使它工作: =importxml(hyperlink(concatenate("AMAZON_URL_HERE"));"//*[@id='priceblock_ourprice']")

您还可以指定元素,如下所示: =importXml("AMAZON_URL_HERE";"//span[@id='priceblock_ourprice']")

这里解释语法:
http://www.w3schools.com/xpath/xpath_syntax.asp