script editor google sheets create new sheet

Solutions on MaxInterview for script editor google sheets create new sheet by the best coders in the world

showing results for - "script editor google sheets create new sheet"
Daniele
20 Mar 2019
1function onOpen() {
2    var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet();
3    var yourNewSheet = activeSpreadsheet.getSheetByName("Name of your new sheet");
4
5    if (yourNewSheet != null) {
6        activeSpreadsheet.deleteSheet(yourNewSheet);
7    }
8
9    yourNewSheet = activeSpreadsheet.insertSheet();
10    yourNewSheet.setName("Name of your new sheet");
11}
12