Skip to main content

getFormula()

returns the formula of a cell

getFormula: (cell: string) => string | string[];

Parameters:

cell: string - the id of a cell

Returns:

The formula of the cell.

Example

var formula = spreadsheet.getFormula("B2");
// -> "ABS(C2)"

The reference to a cell can be specified in the following format:

var formula = spreadsheet.getFormula("sheet1!B2"); // -> "ABS(C2)"

where sheet1 is the name of the tab.

In case the name of the tab isn't specified, the method will return the formula of the cell from the active tab.

Change log:

added in v4.1