-1

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.

6
  • Row !== row Commented Oct 16, 2023 at 16:54
  • ah yes, whoops, the capitalization on the variable was a typo. the variable is indeed incorrect here but even if correct it still reads as 'null'. Commented Oct 16, 2023 at 17:40
  • I have since read that the apps script environment does not pick up passed variables from a spreadsheet cell. instead i have to 'hard code' values to test the script. i will do this now and see if things work. Commented Oct 16, 2023 at 17:42
  • I have since read that the apps script environment does not pick up passed variables from a spreadsheet cell. Not true. Commented Oct 16, 2023 at 18:10
  • 1
    Thanks for help, i worded it wrong. i was passing ROW() into my function and it does indeed work on the sheet. for instance i can check the value of first cell in the row and then set that value in the formula's cell. When i debug in the editor the passed parameter gives a 'null' value. Commented Oct 16, 2023 at 19:02

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.