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");
}

2 Replies to “Automatically create google sheet using script”

  1. Wonderful beat ! I would like to apprentice while you amend your web site, how could i subscribe for a blog website? The account aided me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear idea Inga Baxy Bruckner

Leave a Reply

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