Create new google spreadsheet if sheet exist in my spreatsheet
If you want to check if a certain spreadsheet (byName) exists or not, if not then create it. Now here i am find a sheet named "abonzer" , if not find then create it with 200 rows and 11 columns. Remaning cells Delete.
function initialize() { var ss = SpreadsheetApp.getActiveSpreadsheet(); var mysheet = "abonzer"; if (ss.getSheetByName(mysheet ) == null){ ss.insertSheet('abonzer'); var sheet = ss.getActiveSheet(); sheet.deleteRows(200, 800); sheet.deleteColumns(11, 15); } }
function copyFromTemplate(){
ReplyDeletevar templateSpreadsheet = SpreadsheetApp.openById(TEMPLATE_ID);
var template = templateSpreadsheet.getSheets()[0]; //Assuming it is the first sheet
//The default name will be "Copy of [original name]". We can use today's date to rename it
var today = (new Date()).toDateString();
var currentSpreadsheet = SpreadsheetApp.getActiveSpreadsheet();
template.copyTo(currentSpreadsheet).setName(today);
}