I have a formula in a cell (18,2) which is =(B17-B14)*B15+B17
. So what you see if a numeric value. But when I tried to use the following script to fetch the value to a new cell, it put #num
in the new cell. I tried other cells with formulas, when it is a simple formula, (b+c) for example, the getValue()
works. But not this one. Why? Thank you for your help in advance!
function myfunction1 ()
{
var app=SpreadsheetApp;
var ss=app.getActiveSpreadsheet();
var activeSheet=ss.getActiveSheet();
var range = activeSheet.getRange(18,2);
var fstave=range.getValue();
// retrieve value
activeSheet.getRange(8,8).setValue(fstave);
Logger.log("Value: " + fstave);
}