Copy a Template Sheet as a New Sheet in Google Sheets with Apps Script

  var ui = SpreadsheetApp.getUi();
 
var response = ui.prompt('Copy Template', 'Please Enter Name for this New Sheet', ui.ButtonSet.OK_CANCEL);
 
 
if (response.getSelectedButton() == ui.Button.OK){
   
var ss = SpreadsheetApp.getActiveSpreadsheet();    
   
var sheetWithName = ss.getSheetByName(response.getResponseText());
   
   
if(!sheetWithName) {
     
var sheet = ss.getSheetByName('Template Sheet').copyTo(ss).setName(response.getResponseText());
   }
   
else {
     ui.alert(
'Sheet with that name already exists.');
   }
 }

This code will copy a template sheet to a new sheet in the same file. The user will be prompted to name the sheet. If a sheet with that same exists, a message will be presented to the user and the sheet will not be created.

Prompt Response from User

Class PromptResponse

Visit Learn-Sheets.com for tons of Google Sheets resources