Reading the values of cells that summarize Google Finance data results via Apps Script

老子叫甜甜 提交于 2019-11-26 18:40:41

问题


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

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 = spreadsheet.getRange('B1').getValue();
----> The log show a #DIV/0! error

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

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

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

Thank you.


回答1:


As written in the Official documentation,

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.



来源:https://stackoverflow.com/questions/50656540/reading-the-values-of-cells-that-summarize-google-finance-data-results-via-apps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!