Skip to main content

getFormula()

Description

Returns the formula of a cell

Usage

getFormula(cell: string): string | array;

Parameters

  • cell - (required) the id of a cell

Returns

The method returns a formula of the cell

Example

const spreadsheet = new dhx.Spreadsheet("spreadsheet", {});
spreadsheet.parse(data);

// returns "ABS(C2)"
const formula = spreadsheet.getFormula("B2");
info

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

// returns "ABS(C2)"
const formula = spreadsheet.getFormula("sheet1!B2");

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