This code will automatically create new google sheet ,if google sheet with same name already exists then sheet with same name automatically deleted and create new one..

function onOpen() {
//Get active spreadsheet
    var activeSpreadsheet = SpreadsheetApp.getActiveSpreadsheet();
//Giving name of your new sheet
    var NewSheet = activeSpreadsheet.getSheetByName("Name of your sheet");
//Check if sheet exists with same name,if exist then this code will delete existing sheet
    if (yourNewSheet != null) {
        activeSpreadsheet.deleteSheet(NewSheet);
    }

    NewSheet = activeSpreadsheet.insertSheet();
    NewSheet.setName("Name of new sheet");
}

Leave a Reply

Your email address will not be published. Required fields are marked *