get range google script code example

Example 1: getranges google script

let SS = APP.getActiveSpreadsheet();
let sheetIndex0 = SS.getSheets()[0];

sheetIndex0.getRangeList(['A1', 'B1:C7']).setHorizontalAlignment("center");

Example 2: google script get sheet size

var lastColumn = sheet.getLastColumn();
// Returns the position of the last column that has content.

Example 3: google apps scipt getRange

getRange(row, column, numRows, numColumns)

Example 4: 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

Example 5: .setRowHeights google script

var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[0];

// Sets the first three rows to a height of 20 pixels
sheet.setRowHeights(1, 3, 20);

Tags:

Misc Example