BeforeSheetRename

fires before a sheet is renamed

boolean BeforeSheetRename(object sheet,string newVal){ ... };

Parameters

sheetobjectthe object of a sheet
newValstringthe new name of the sheet

Returns

booleantrue to rename a sheet, false to prevent a sheet from being renamed

Example

spreadsheet.events.on("beforeSheetRename", function(sheet, newVal) {
    console.log("The ", sheet.name, "sheet will be renamed to ", newVal);
    return true;
});

Details

The sheet object contains the following parameters:

  • name - (string) the old name of the sheet
  • id - (string) the id of the sheet

The event is blockable, returning false will prevent the sheet from being renamed.

Change log

added in v4.1

Back to top