SpreadsheetFunctionPlugin
This interface defines the methods of a spreadsheet function:
interface SpreadsheetFunction { getName(): string; getValue(params: any[]): any; replaceAutofill(formula: string, direction: string, delta: number): string;}Example
Section titled “Example”See the spreadsheet function plugin page for an example.
getName(): string
Section titled “getName(): string”This method names the function, i.e. the part before the first parenthesis. E.g. for the sum function this should return just 'SUM'.
Returns
The name of the spreadsheet function.
getValue(params: any[]): any
Section titled “getValue(params: any[]): any”This method effectively defines how many and which parameters are allowed. Based on the parameters, an appropriate result is returned.
Parameters
params: any[]an array of typed parameters accepted in the function.
Returns
An appropriate scalar result, i.e. only primitive data types are allowed.
replaceAutofill(formula: string, direction: string, delta: number): string
Section titled “replaceAutofill(formula: string, direction: string, delta: number): string”This method is optional, and should only be implemented if something should be updated when the drag handle is used for auto filling cells..
Parameters
formula: stringthe formula that are being copied.direction: stringthe direction of the drag handle. One of the following values:['up', 'down', 'left', 'right'].delta: numberthe distance from the root cell. Negative if direction is['up', 'left'].
Returns
The updated formula.