Skip to main content

beforeSheetRename

fires before a sheet is renamed

beforeSheetRename: (sheet: ISheet, value: string) => void | boolean;

Parameters:

  • sheet: object - the object of a sheet
  • value: string - the new name of the sheet

Returns:

True to rename a sheet, false to prevent a sheet from being renamed.

Example

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

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