get a range spreadsheet code example

Example 1: spreadsheet range to a variable

var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
var range = sheet.getRange('A1:D10');
//range.activate();
var values = range.getValues();
//Logger.log(values[0][0]);

Example 2: google sheets get ranges

//getRange(row, column, optNumRows, optNumColumns);
Sheet.getRange(1,1,1,12);

//row --- int --- top row of the range
//column --- int--- leftmost column of the range
//optNumRows --- int --- number of rows in the range.
//optNumColumns --- int --- number of columns in the range

Tags:

Go Example