1
votes

I have a Google Apps Script pulling data from a Google Sheet, which gets data via GoogleFinance, (image attached) the price difference "=GOOGLEFINANCE(A2, "change")" works fine, but the close price which is called via "=INDEX(GOOGLEFINANCE((A3), "close", F2),2,2)" just returns #REF!

screen grab

I have tried the getValue and getDisplayValue, but this makes no difference

for(var i = 2; i < 72; i++) {
   var thePrice = sheet.getRange('B' + i).getValue();
   var sharename = sheet.getRange('D'+ i).getValue();
   var theDifference = sheet.getRange('C'+ i).getValue();
}
1
Is the #REF! returned in the sheet or in your code?Jason Allshorn
Hi Jason, in the code, the sheet displays what I'd expect, but reading the reply below it seems GoogleFinance historical data is no longer accessible outside of Sheets, thanks anyway.Nick Clarkson

1 Answers

1
votes

Historical GOOGLEFINANCE data no longer accessible outside of Google Sheet. If you have a spreadsheet with historical data generated from the GOOGLEFINANCE function and you try to download it or access it via Apps Script or an API, the corresponding cells will show #N/A.

For more info: G Suite update Blog

Also, it has been raised in the App Script issue tracker and the response from Google is "Won't Fix (Intended behavior)"