我尝试打印从Yahoo财务到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]")单元格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?
我注意到,在Yahoo Pices的html代码中,大约100天在tr标签中没有此"data-reactid = 1520".
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.
在不使用JavaScript的情况下将前100个值加载到页面中(如您通过为 sg.finance.yahoo/quote/SPY/history?p=SPY 并重新加载页面),则可以通过.
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无法检索新的可用数据-就公式而言,没有101 st <tr>元素,因此显示N/A: Imported content is empty.
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 .
我知道这通常是个坏消息,但我希望这对您有帮助!
I know this is generally bad news, but I hope this is helpful to you!
- IMPORTXML-文档编辑器帮助
- Google表格importXML返回空值
更多推荐
雅虎财经对Google表格的历史收盘价在100天后返回n/a
发布评论