Passing parameters into custom function giving "null" result

55 Views Asked by At

In a cell i have a custom function where im trying to pass the row number. =myCustomFunction(row())

function myCustomFunction(row){ var currentRow = Row; Logger.log(currentRow); }

The result from the log is 'Null' where i would expect the number of the row.

However i can return the variable and it will show up in the cell just fine.

function myCustomFunction(row){ var currentRow = Row; return currentRow; }

This will put the number of the row in the cell as expected but i would like to use the row number in the function and do things with it. any insight is much appreciated.

1

There are 1 best solutions below

1
Martin Padwick On

After some investigating I have discovered that when the apps script is run from the script editor, It does not pick up passed parameters from a custom formula in a cell.

Additionally I have discovered that custom formula's in a cell cannot setValue to other cells. Other cells are read only.