Skip to main content

SetValue

Sets a value to the current cell or cell range.

Syntax

expression.SetValue(data);

expression - A variable that represents a ApiRange class.

Parameters

NameRequired/OptionalData typeDefaultDescription
dataRequiredstring | boolean | number | (string | boolean | number)[] | (string | boolean | number)[][]The general value for the cell or cell range.

Returns

boolean

Example

This example sets a value to cells.

let worksheet = Api.GetActiveSheet();
worksheet.GetRange("B1").SetValue("2");
worksheet.GetRange("B2").SetValue("2");
worksheet.GetRange("A3").SetValue("2x2=");
worksheet.GetRange("B3").SetValue("=B1*B2");