Adding custom functions

Starting from version 8.1, you can add custom functions to the spreadsheets using the Macros plugin:

  1. Open the Plugins tab and select Macros. The macros window will pop up.
  2. In the Custom functions section, click Plus icon. 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);
})();
  1. 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.
  2. Click Save.

Add custom function

Now you can use this function in the spreadsheet.

Add function usage

If you want to rename your function, click Dots icon 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 Dots icon next to the custom function name and select Delete.

You can also copy your function. To do this, click Dots icon next to the custom function name and select Copy.

Custom function menu

Get Help

  • If you have any questions about ONLYOFFICE Docs, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).