使用IMPORTXML xpath导入表

时间:2016-09-15 13:55:25

标签: xpath google-sheets

我正在尝试从以下网站导入表格 http://financials.morningstar.com/valuation/price-ratio.html?t=MOS&region=usa&culture=en-US 使用谷歌电子表格函数ImportXML,我有xpath问题我发现这个为我正在寻找的表:  //*[@id="valuation_history_table"]

我正在使用此公式=importXML(A4,"//*[@id="valuation_history_table"]")

但是我收到以下错误消息:

  

错误
  公式解析错误。

你能帮帮我吗?

1 个答案:

答案 0 :(得分:0)

你得到一个公式解析错误,因为你在xpath中使用了双引号 - 你无论如何都无法将它拉出来 - 如果你想要一个更轻,更简单的端点而不是使用这个url(所有参数基本上都是相同)但您可以使用xpath //tr并获取整个表

 =IMPORTXML("http://financials.morningstar.com/valuate/valuation-history.action?&t=XNYS:MOS&region=usa&culture=en-US&cur=&type=price-earnings","//tr")

enter image description here