get cell value google script code example

Example 1: set cell value google script

function doTest() {
  SpreadsheetApp.getActiveSheet().getRange('F2').setValue('Hello');
}

Example 2: set cell value google script

function storeValue() {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  // ss is now the spreadsheet the script is associated with
  var sheet = ss.getSheets()[0]; // sheets are counted starting from 0
  // sheet is the first worksheet in the spreadsheet
  var cell = sheet.getRange("B2"); 
  cell.setValue(100);
}

Example 3: cell get row google script

var cell = sheet1.getActiveCell();
var SelectRow = cell.getRow();

Example 4: set cell value google script

var values = [
  ["2.000", "1,000,000", "$2.99"]
];

var range = sheet.getRange("B2:D2");
range.setValues(values);

Example 5: get cell value from string google sheets

=CONCAT("value is ", C5)

Example 6: get data of active cell google script

let actSheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  let actData = actSheet.getActiveRange().getValue();

Tags: