setFormat

sets a specified format to the value of a cell

void setFormat(string cell,string format);

Parameters

cellstringthe id of a cell the value of which should be formatted
formatstringthe name of the number format to apply to a cell value

Example

// applies the currency format to the cell A1
spreadsheet.setFormat("A1","currency");

Details

Starting with v4.1, the reference to a cell can be specified in the following format:

spreadsheet.setFormat("sheet1!A2", "number");

where sheet1 is the name of the tab.

In case the name of the tab isn't specified, the method will set the format to the value of a cell of the active tab.

See also
Back to top