google sheets change cell value code example
Example 1: read every cell in a column google app script
function appendString() {
var range = SpreadsheetApp.getActiveSheet().getActiveRange();
var values = range.getValues();
var modified = values.map(function (row) {
return row.map(function (col) {
return col + " string";
});
})
range.setValues(modified);
}
Example 2: set cell value google script
function doTest() {
SpreadsheetApp.getActiveSheet().getRange('F2').setValue('Hello');
}
Example 3: set cell value google script
var values = [
["2.000", "1,000,000", "$2.99"]
];
var range = sheet.getRange("B2:D2");
range.setValues(values);
Example 4: read every cell in a column google app script
function appendString() {
const range = SpreadsheetApp.getActiveSheet().getActiveRange();
const values = range.getValues();
const modified = values.map(row => row.map(currentValue => currentValue + " string"));
range.setValues(modified);
}