Get a sheet object by name

Source Code

function getSheetObject() {
  var targetName = "2nd sheet";
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var sh = spreadsheet.getSheetByName(targetName);
}

Format

SpreadsheetObject.getSheetByName(name)

Parameters

name … a targeted sheet’s name

Responses

Sheet Object

Note

GAS doesn’t provide a function to get sheet objects by sheet’s ID.

4 thoughts on “Get a sheet object by name”

Leave a Comment