setValue

sets a value for a cell(s)

void setValue(string cells,string|number|array value);

Parameters

cellsstringthe id of a cell or a range of cells
valuestring|number|arraythe value(s) to be set for a cell/cells

Example

// setting value for one cell
spreadsheet.setValue("A1",5);
// setting the same value for a range of cells
spreadsheet.setValue("A1:D1",5);
// setting the same value for different cells
spreadsheet.setValue("B6,A1:D1",5);
// setting values from an array for cells in a range alternately
spreadsheet.setValue("A1:D1",[1,2,3]);

Details

The method allows setting the same/repeated value(s) for the specified cells. In case you want to add different values into spreadsheet cells, you'd better use the parse method.

Related sample:  Basic spreadsheet

See also
Back to top