Author

Topic: Need help: Building a custom function for Google spreadsheet to Copy/Paste Value (Read 191 times)

newbie
Activity: 62
Merit: 0
Hi,
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:
Quote
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:
Quote
Missing ) after formal parameters. (line 1)

if I remove "int" before the formal params, it said I cannot getRange NULL.
Please help me to fix this. Thanks
Jump to: