Skip to content

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;
}

See the spreadsheet function plugin page for an example.

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.

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: string the formula that are being copied.
  • direction: string the direction of the drag handle. One of the following values: ['up', 'down', 'left', 'right'].
  • delta: number the distance from the root cell. Negative if direction is ['up', 'left'].

Returns

The updated formula.