Spreadsheets, Sheets, and Ranges

-

Access and Modify

Rename the active spreadsheet

function renameSpreadsheet() {
  var mySS = SpreadsheetApp.getActiveSpreadsheet();
  mySS.rename("2017 Avocado Prices in Portland, Seattle");
}

Duplicate the active sheet

function duplicateAndOrganizeActiveSheet() {
  var mySS = SpreadsheetApp.getActiveSpreadsheet();
  var duplicateSheet = mySS.duplicateActiveSheet();
}

Change the sheet's name

function duplicateAndOrganizeActiveSheet() {
  var mySS = SpreadsheetApp.getActiveSpreadsheet();
  var duplicateSheet = mySS.duplicateActiveSheet();

  // Change the name of the new sheet.
  duplicateSheet.setName("Sheet_" + duplicateSheet.getSheetId());
}

Modify a sheet's columns and rows

Move ranges

Sort ranges

Reference : https://developers.google.com/codelabs/apps-script-fundamentals-2?hl=en&continue=https%3A%2F%2Fcodelabs.developers.google.com%2F#0

Last updated

Was this helpful?