Adding custom functions
Starting from version 8.1, you can add custom functions to the spreadsheets using the Macros plugin:
- Open the View tab and select Macros. The macros window will pop up.
- In the Custom functions section, click . You will be presented with the custom function template:
(function()
{
/**
* Function that returns the argument
* @customfunction
* @param {any} arg Any data.
* @returns {any} The argumet of the function.
*/
function myFunction(arg) {
return arg;
}
Api.AddCustomFunction(myFunction);
})();
- Write a description for your function, specify the parameters and return value if necessary. Add a script for your function. Use the Api.AddCustomFunction method to add a function to the system.
- Click Save.
Now you can use this function in the spreadsheet.
If you want to rename your function, click next to the custom function name and select Rename. Enter a new name for the custom function and click Ok.
To delete an unnecessary custom function, click next to the custom function name and select Delete.
You can also copy your function. To do this, click next to the custom function name and select Copy.