Skip to main content
setCellValues
Mitch Stutler avatar
Written by Mitch Stutler
Updated over 9 months ago

The setCellValues operation allows you to set the value of multiple cells through the SheetSearch API. This will likely be followed by other operations, most commonly saveSheetData. setCellValues needs an array of objects as the parameter. The objects need to be formatted with a cell key property and a value property.

// Initialize SheetSearch
var sheet = new x_vivid_sheets.SheetSearch('a6b4ff402bac8af00df574cf034bcb3d');

// Create an array to hold new cell values
var cellUpdates = [];

// Add cells to update to array
cellUpdates.push({ "cell": 'A1', "value": 1 });
cellUpdates.push({ "cell": 'B1', "value": 'test' });
cellUpdates.push({ "cell": 'C1', "value": 1.04 });

// Set the updated values on the sheet
sheet.setCellValues(cellUpdates);

// Save the sheet's data
sheet.saveSheetData();

Did this answer your question?