通过 Apps 脚本读取汇总 Google 财经数据结果的单元格的值 [英] Reading the values of cells that summarize Google Finance data results via Apps Script

查看:24
本文介绍了通过 Apps 脚本读取汇总 Google 财经数据结果的单元格的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当平均值超过 Google 财经数据时,Apps 脚本似乎无法处理使用平均值公式的单元格:

Apps Script seems to be unable to deal with a cell that uses the average formula, when the average is over Google Finance data:

考虑到 A 列充满了来自 Google 财经的数据.然后在单元格 B1 中输入 =average(A1:A100).让我们假设平均值是 5,因此单元格 B1 显示 5.很好,除了使用以下脚本会失败:

Consider that column A is full of data from Google Finance. Then you type into cell B1 =average(A1:A100). Lets assume the average is 5 and as such cell, B1 shows 5. Great, except that using the following script will fail:

var AveResult =电子表格.getRange('B1').getValue();
----> 日志显示#DIV/0!错误

var AveResult = spreadsheet.getRange('B1').getValue();
----> The log show a #DIV/0! error

另一方面,如果您覆盖 B1 中的公式并简单地输入 5,那么它可以完美运行:

On the other hand, if you overwrite the formula in B1 and simply type in a 5, then it works perfectly:

var AveResult =电子表格.getRange('B1').getValue();
---->日志显示5

var AveResult = spreadsheet.getRange('B1').getValue();
----> The log shows 5

有没有办法解决这个问题,使用带有 Google 财经数据摘要的脚本?

Is there any way to get around this problem, to use scripts with summaries of Google Finance data?

谢谢.

推荐答案

官方所写文档,

无法通过 Sheets API 或 Apps 脚本下载或访问历史数据.如果您尝试这样做,您将看到 #N/A 错误代替相应单元格中的值的电子表格.

Historical data cannot be downloaded or accessed via the Sheets API or Apps Script. If you attempt to do so, you will see a #N/A error in place of the values in the corresponding cells of your spreadsheet.

平均公式不是问题.任何通过任何公式框获取历史财务数据的尝试似乎都不可能.

The average formula is NOT the problem. Any attempt to take historical finance data through any formula hoops doesn't seem to be possible.

然而,实时数据似乎并没有以同样的方式受到限制.

However live data doesn't seem to be restricted the same way.

这篇关于通过 Apps 脚本读取汇总 Google 财经数据结果的单元格的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆