我尝试将历史调整后的收盘价从雅虎财经打印到 Google 表格.
I try to print historic adjusted close prices from Yahoo finance to Google Sheets.
=ImportXML("sg.finance.yahoo/quote/"&B57&"/history?p="&B57, "//tbody/tr[21]/td[6]")Cell B57 例如SPY".
这适用于长达 100 天的历史价格.(这里调整:tr[100])
This works fine for historic prices up to 100 days. (it is adjusted here: tr[100])
当我尝试在 100 天后获取价格时,它返回N/A".这些价格可以在雅虎财经上看到.
When I try to get prices later 100 days it returns "N/A". These prices are visible on yahoo finance.
有没有办法调整 XPATH 使其有效?
It there a way to adjust XPATH that it works?
我注意到,在大约 100 天的 yahoo pices 的 html 代码中没有这个data-reactid=1520";在 tr 标签中.
I noticed, that in the html code of yahoo pices about 100 days don't have this "data-reactid=1520" in the tr tag.
推荐答案答案:
IMPORTXML 无法检索由脚本填充的数据,因此无法使用此公式从该表中检索数据.
Answer:
IMPORTXML can not retrieve data which is populated by a script, and so using this formula to retrieve data from this table is not possible to do.
因为前 100 个值是在不使用 JavaScript 的情况下加载到页面中的(正如您可以通过为 sg.finance.yahoo/quote/SPY/history?p=SPY 并重新加载页面),信息可以通过IMPORTXML.
As the first 100 values are loaded into the page without the use of JavaScript (as you can see by disabling JavaScript for sg.finance.yahoo/quote/SPY/history?p=SPY and reloading the page), the information can be retrieved by IMPORTXML.
由于前 100 个结果之后的数据是在向下滚动页面后即时生成的,因此 IMPORTXML 无法检索新可用的数据 - 就公式而言,没有 101st
As the data after the first 100 results is generated on-the-fly after scrolling down the page, the newly available data is not retrievable by IMPORTXML - as far as the formula sees, there is no 101st <tr> element and so it displays N/A: Imported content is empty .
- IMPORTXML - 文档编辑器帮助
- Google 表格 importXML 返回空值
更多推荐
雅虎财经历史收盘价对谷歌表的收盘价在 100 天后返回 n/a
- 上一篇: Yahoo Finance如何计算调整后的收盘价?
- 下一篇: 如何获得特定日期的收盘价
发布评论