I am creating employee rosters for each division at my job that need to be checked daily. I have the roster and I would like to create a certain date range worth in a workbook for each division. I have the first sheet dated 090120, for example, and need to duplicate and rename up to 091220. Is there an easy way to do this without having to right click, duplicate, right click, rename on each tab? All the information for each one is identical and there are no formulas or anything like that. I am new to Google Sheets and am not tech savvy at all but there has to be an easier way to do this.
function duplicateSheet(){
const ss = SpreadsheetApp.getActive();
const src_sheet = ss.getSheetByName('090120');
const dupl_sheets = ['090220','090320','090420','090520','090620',
'090720','090820','090920','091020','091120','091220'];
dupl_sheets.forEach(sheet=>{
var dupl_sheet=src_sheet.copyTo(ss);
dupl_sheet.setName(sheet);
});
}
dupl_sheets
contains the names of the duplicate sheets you want to create. dupl_sheets
and for every sheet name it creates a sheet that is a duplicate of src_sheet
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.