- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从 https://finance.yahoo.com/ 中提取“远期股息和 yield ”值将不同市场的多家公司导入 Google 表格。
这是成功的:
=IMPORTXML("https://finance.yahoo.com/quote/WBS", "//*[@id='quote-summary']/div[2]/table/tbody/tr[6]/td[2]")
但这失败了#N/A:
=IMPORTXML("https://finance.yahoo.com/quote/CBA.AX", "//*[@id='quote-summary']/div[2]/table/tbody/tr[6]/td[2]")
我不知道 ASX 股票代码需要有什么不同,为什么 CBA.AX 会导致问题?
非常感谢任何帮助
最佳答案
当我测试=IMPORTXML("https://finance.yahoo.com/quote/CBA.AX", "//*")
的公式时,出现的错误找不到 url 上的错误资源。
发生。我认为这可能是您遇到问题的原因。
但幸运的是,当我尝试使用 Google Apps 脚本从同一 URL 检索 HTML 时,可以检索 HTML。因此,在这个答案中,我想建议使用由 Google Apps 脚本创建的自定义函数来检索值。示例脚本如下。
请将以下脚本复制并粘贴到 Google Spreadsheet 的脚本编辑器中并保存。并且,请将公式 =SAMPLE("https://finance.yahoo.com/quote/CBA.AX")
放入单元格。通过这个,值被检索。
function SAMPLE(url) {
const res = UrlFetchApp.fetch(url).getContentText().match(/DIVIDEND_AND_YIELD-value.+?>(.+?)</);
return res && res.length > 1 ? res[1] : "No value";
}
当使用上面的脚本时,会得到如下结果。
=SAMPLE("https://finance.yahoo.com/quote/WBS")
。IMPORTXML
和 xpath 相同。所以请小心这一点。关于google-sheets-formula - Google 表格 IMPORTXML 无法获取 ASX 数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67480449/
过去几天我一直在尝试弄清楚如何使用以下 XMLIMPORT 只获取第一个元素。 这是我要抓取的网站的 URL:https://www.grainger.com/product/DURACELL-Bat
我正在尝试从服务器中托管的 xml 导入节点,但出现错误:=importxml("http://www.jaguatiricadigital.com/notas_xml/NFe331501170824
过去几天我一直在尝试弄清楚如何使用以下 XMLIMPORT 只获取第一个元素。 这是我要抓取的网站的 URL:https://www.grainger.com/product/DURACELL-Bat
尝试在 Google 工作表上制作电子表格,从网站上抓取数据。 我正在尝试从 rsbuddy exchange 获取商品的售价,例如: https://rsbuddy.com/exchange/?id
我需要解析 otcmarkets.com 上一组给定股票的 Assets 负债表数据。我正在尝试使用 Google 电子表格中的 importXML 函数,但它没有为我返回任何数据。 xPath 查询
我正在尝试使用 Xpath 从网页中提取元描述,使用 Google 表格。 我有这个工作来引入标题:=importXml(www.example.com; "//title") 以下是我学习的两个来源
我想强制 importXML 每五分钟自动刷新一次。这是我尝试运行并收到错误“错误值(第 7 行,文件“RefreshImports”)的脚本。我不知道为什么。我在这里找到它:Periodically
我正在尝试研究如何在 Google 电子表格中正确使用 ImportXML。我正在尝试从此 URL 中获取键“last”的值: https://www.bitstamp.net/api/ticker/
基本上是标题:我可以从 Yahoo Finance 获取数据 ASML自动收报机 =IMPORTXML("https://finance.yahoo.com/quote/ASML/", "//*[@i
如何从 here 获得“Div/yield”值?我试过//td[node()='Div/yield'和 //td[text()='Div/yield' . 和 //td[@data-snapfield
我正在使用 Google 表格作为网络抓取工具。 我一直在使用这个 IMPORTXML =importxml(A1, "//div[@class='review-content']//text()")
尝试使用 =ImportXML 解析 Google 文档中的 Alexa 排名。以下有效并显示全局排名: =value(ImportXML(CONCATENATE("http://data.alexa
我已经在 Google 电子表格中填写了大约 500 个 URL 和 Xpath。在发现 ImportXML 有一些缺点之后(即使只运行 10 个左右的函数,它也会出现永久加载错误)。我正在寻找另一种
ImportXML 的 JavaScript 等价物是什么? ? 有一个包含 10,000 行的 Google 电子表格,每行包含一个城市和州。要查找他们的邮政编码,neither the Impor
我正在尝试使用来自 Google 表格的 importXML 在网站上定位价格。我的目标代码如下: £29.99 因为它在类“new_price”中,所以我的导入不起作用: =importXm
当试图在谷歌应用程序脚本中将 html 解析为 xml 时,此代码: var yahoo= 'http://finance.yahoo.com/q?s=aapl' var xml = UrlFetch
我正在使用 GoogleSheet 的 IMPORTXML 函数来检索一年前的每个日历日期或最近的可用数据的一年前日期的数据。 这是数据样本 ( full data source is here ):
这是一个很棒的网站,我已经有很多问题的答案,只需滚动和搜索其他帖子。不幸的是,我似乎找不到一个特别有助于解决这个问题的答案,我想我应该试着发帖寻求帮助- 我正在使用importxml和google电子
我正在使用 ImportXML在 Google 电子表格中访问 user_timeline method in the Twitter API .我想提取 created_at和 text响应中的字段
我正在尝试使用类似于 Google 电子表格的 importxml 的 excel 函数。 这是代码: Function GetData(sURL As String, sItem As String
我是一名优秀的程序员,十分优秀!