Nick Clarkson
Nick Clarkson

Reputation: 11

Google apps script not returning data

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();
}

Upvotes: 1

Views: 377

Answers (1)

Ritesh Nair
Ritesh Nair

Reputation: 3355

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)"

Upvotes: 1

Related Questions