Skip to content

Instantly share code, notes, and snippets.

@rheajt
Created August 26, 2016 05:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rheajt/786fcd615c3d7e5acdb42165cf7af151 to your computer and use it in GitHub Desktop.
Save rheajt/786fcd615c3d7e5acdb42165cf7af151 to your computer and use it in GitHub Desktop.
duplicate a template sheet in google sheets
function duplicate() {
//number of duplicates to make
var numOfDupes = 40;
//create the spreadsheet object
var ss = SpreadsheetApp.getActiveSpreadsheet();
//we are going to loop the number of duplicates we want
for(var i = 1; i <= numOfDupes; i++) {
//this line of code duplicates the active sheet in the spreadsheet
//be careful that you have the correct sheet activated, or be sure to explicitly activate in the code
ss.duplicateActiveSheet().setName('Week ' + i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment