I'm building a function to get Value from another cell. It will work this way:
At cell A1, I place function = copyValue(B1)
or = copyValue(1 , 2)
so that custom function will return the value of B1.
Here is my code:
function copyValue(int a,b) {
var ss = SpreadsheetApp.openById('1HTEuyd7po43VKM37nmzCvPgLEVESgcN5YpAu2VRTiFI');
var sheet = ss.getSheetByName("Total");
var cell = sheet.getRange(a,b);
var c = cell.getValue();
return(c);
}
But when I run, it said:
Missing ) after formal parameters. (line 1)
If I remove "int" before the formal params, it says I cannot getRange NULL
.
You can make your function much simpler if all you are trying to do is get the value of a cell.
function copyValue(cell) {
return cell;
}
Then in your sheet just do =copyValue(B1)
and whatever your value is in B1 will be returned into the cell.