I am recording the difference between the current currency value and yesterdays close on an hour by hour basis, using scripts in Google Sheets to automatically add new rows each hour with the new values.
For the most part this works fine, however the Google Finance formula for Historic data displays the data in a 2x2 array.
=GOOGLEFINANCE("CURRENCY:USDGBP", "close", TODAY()-1, TODAY())
Using scripts I need to reference the Close value returned in Column 2, Row 2 of the array for further calculations.
var CloseVal = sheet.getRange("$I$13").getDisplayValue();
console.log(posNeg);
sheet.getRange(numRows + 1,3).setValue(CloseVal);
However when I try to reference the results of the array using scripts as above, it returns a null value. It suggests that while the value is displayed in this cell, it doesn't actually exist there.
I've tried using getDisplayValue and also referencing the formula cell to no available.
Does anyone know how I can get the value to return?