The Spreadsheet API provides the capability to create your own custom functions. Custom functions are available for spreadsheet calculations, and can be used in formulas in the same manner as built-in functions. The main difference is that custom functions are not saved in a workbook file. They should be added in code to the Workbook.CustomFunctions or the Workbook.GlobalCustomFunctions collection.
A custom function called in a worksheet cell should not change the properties and characteristics of the worksheet. The IFunction.Evaluate method of the function has access to the EvaluationContext object, which provides information about the current worksheet and workbook. However, do not call methods or set properties that might perform the following actions:
Insert, delete, or format cells;
Move, rename, delete, or add sheets to a workbook;
This built-in dialog assists you with specifying the arguments of the custom function. To provide captions and text descriptions specific to the custom function, use the ICustomFunctionDescriptionsRegisterService service.