来自 yahoo finance 的 Xpath 数据提取 table

Xpath data extraction from yahoo finance table

想要在 google 电子表格中获取雅虎数据。我不想要来自 google 财务的 google 数据,所以请不要建议。我想要电子表格中的雅虎财经数据。

我想要以下电子表格中的可编辑数据:

https://docs.google.com/spreadsheets/d/1_MQyyaeEtGD0p9l7ncFqyLDWDKsnLNh2XBcH5CiHkF8/edit?usp=sharing

我只想要前五天的特定列数据。雅虎数据提取的 link 是:

https://in.finance.yahoo.com/quote/abb.BO/history/?guccounter=1

我附上图片以供参考。

谢谢enter image description here

请帮助我如何专门从一列中提取数据。

我知道我必须使用 =transpose(importxml("url,xpath) 但我不确定 xpath。

谢谢

您想检索 "close" 的最新 5 个值,即黄色范围。如果我的理解是正确的,这个修改怎么样?

修改点:

  • 在您的 xpath 中,无法使用 //[@class="Pb(10px) Ovx(a) W(100%)"。如果要从 class Pb(10px) Ovx(a) W(100%) 或 div 中检索值,请修改 "//div[@class='Pb(10px) Ovx(a) W(100%)']"。此 xpath 包含您想要的值。但它不能只检索 "close" 的最新 5 个值。
    • 所以我想建议 "//tr[position()<6]/td[5]" 作为 xpath。

修改后的公式:

=TRANSPOSE(IMPORTXML(A1,"//tr[position()<6]/td[5]"))
  • https://in.finance.yahoo.com/quote/abb.BO/history/?guccounter=1 放在 "A1".

结果:

如果这不是你想要的,我很抱歉。