Google App Script
Needed to copy and rename a google sheet ? For example you have a template and needed to create a brand new instance each day
Can use the code snippet below
- Open the template in google sheet
- Go to Extensions -> App Script
- Copy and paste the script into the box
- You might need to create a project, just follow the steps
- Hit Run and it will then create a duplicates of the template sheet
# There is a +- 5 minutes run time, and each creation of sheet takes +- 5 seconds# You might need to createfunction myFunction() { var ss = SpreadsheetApp.getActiveSpreadsheet(); # Example duplicate the file 10 times, with an ascending counter duplicate = 10; for (var i = 0; i <= duplicate; i++) { # Here I pad the number to be 4 digits, but this can be changed as per requirement var new_sheet = ss.copy("Pohon-" + String(i).padStart(4, '0')); # It will then print the sheet URL into the log Logger.log(String(i) + "|" + new_sheet.getUrl()); }}