I am attempting to create a simple custom function:
/**
* Payout.gs script
* @customfunction
*/
function barberPayoutService(input1, input2) {
return input1 - input2
}
When I attempt to use it in my spreadsheet, I get the following Error:
Aug 23, 2021, 9:01:34 PM Error Exception: You do not have permission to call getActiveUser at unknown function Globals:13:23
I have another script in there called "Globals.gs" where line 23 contains getActiveUser. There is nothing in the custom function that should be calling Globals.gs at all. I am not sure why this is executing on calculation. Any insight on this?
If the call to getActiveUser
in the Global.gs
script is not confined within a function--i.e. if it is defined globally--then it will run each time any piece of the script, regardless of which file it is from, gets invoked. So, if you call your custom function in one file, any global variables from another file still get defined, which is causing your error.