builder.CreateFile("xlsx");
/**
* Calculates the sum of the specified numbers.
* @customfunction
* @nameLocale {ru: Добавить | fr:Ajouter | es:Añadir}
* @param {number} first The first number
* @param {number} [second] The second number
* @returns {number} The sum of the numbers.
*/
Api.AddCustomFunction(function ADD(first, second) {
if (second === null) {
second = 0;
}
return first + second;
});
var oWorksheet = Api.GetActiveSheet();
oWorksheet.GetRange('A1').SetValue('=ADD(1,2)');
builder.SaveFile("xlsx", "AddCustomFunction.xlsx");
builder.CloseFile();
https://api.onlyoffice.com/officeapi/spreadsheetapi/api/addcustomfunction https://api.onlyoffice.com/officeapi/spreadsheetapi/api/clearcustomfunctions https://api.onlyoffice.com/officeapi/spreadsheetapi/api/removecustomfunction