function duplicateAndRenameSheet() {
const prefix="Copy of ";//add in front of new name
const postfix= ' ' + Utilities.formatDate(new Date(),Session.getScriptTimeZone,"E yyMMdd:HHmmss");//add to back of new name
const ss=SpreadsheetApp.getActive();
const sh=ss.getActiveSheet();
let name=sh.getName();//active sheets name
let nsh=ss.insertSheet({template:sh});//inserts a new sheet that's a copy of the active sheet
nsh.setName(prefix + name + postfix);//renames the new sheet
}
Spreadsheet Methods
Sheet Methods
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…