雅虎财经历史收盘价对谷歌表的收盘价在 100 天后返回 n/a [英] Yahoo finance historical close price to google sheets returns n/a for close later than 100 days
问题描述
我尝试将历史调整后的收盘价从雅虎财经打印到 Google 表格.
I try to print historic adjusted close prices from Yahoo finance to Google Sheets.
=ImportXML("https://sg.finance.yahoo.com/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 的情况下加载到页面中的(正如您可以通过为 https://sg.finance.yahoo.com/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 https://sg.finance.yahoo.com/quote/SPY/history?p=SPY and reloading the page), the information can be retrieved by IMPORTXML
.
由于前 100 个结果之后的数据是在向下滚动页面后即时生成的,因此 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 这篇关于雅虎财经历史收盘价对谷歌表的收盘价在 100 天后返回 n/a的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!IMPORTXML
无法检索新可用的数据 - 就公式而言,没有 101st 元素,所以它显示 N/A: Imported content is empty
.
IMPORTXML
- as far as the formula sees, there is no 101st <tr>
element and so it displays N/A: Imported content is empty
.
登录
关闭