Reputation: 771
By the way, I specifically mean using a user-defined function made in one script inside of another, entirely different spreadsheet, inside of the spreadsheet itself. I already know how to use a function from one script inside of another script, but I do not know how to use said function in the actual spreadsheet itself.
My goal here is to create a 'master' script containing all user-defined functions to be used in any spreadsheet.
So if I made this script called 'TemplateScripts':
How could I use it like any other Google Sheets function in another spreadsheet? I hoped it would be the following, but it fails to work:
By the way, I have already done the necessary setup to use the functions from 'TemplateScripts' inside of the script file associated with the 'Ducks are Cute' spreadsheet, but can't use it as a function in the spreadsheet itself.
Upvotes: 2
Views: 79
Reputation: 1118
I have found a hack here: https://stackoverflow.com/a/41287146/4970466. Basically do some reflection to inspect the current "this" context and retrieve the function given as parametrs. Not perfect, but at least it works.
Upvotes: 0
Reputation: 348
You dont use script editor name as a function. Put this above your script in scrip editor
/**
*@customfunction
*/
and use =reverseCols(D1:F1)
in spreadsheet
Upvotes: 1