I wish to create a duplicate sheet, using the sheet named Template
after a form has been submitted, "Form responses 1"= "Yes" of if easier someone enters "Yes" from a drop down sheet from a sheet named Start
and a duplicate of Template
is created, with the name from that cell. I Have attempted using the code below but would appreciate simple instructions.
function CreateNewTimesheet()
{
// The code below makes a duplicate of the active sheet
var ss = SpreadsheetApp.getActiveSpreadsheet()
SpreadsheetApp.getActiveSpreadsheet().duplicateActiveSheet();
// The code below will rename the active sheet to Month End date based on cell O3
var myValue = SpreadsheetApp.getActiveSheet( ).getRange("O3").getValue();
SpreadsheetApp.getActiveSpreadsheet().renameActiveSheet(myValue);
}
Your question is not clear what exactly you are trying to achieve.
I have written few code lines, may be this will help you.
function myFunction() {
var ss = SpreadsheetApp.getActive();
//get template sheet
var templateSheet =ss.getSheetByName('Template').activate();
//make a copy of template sheet
var copySheet = ss.duplicateActiveSheet();
//CHange new sheet nane
var newSheetName = ss.getRange('Form Resposes 1!A1').getValue();
copySheet.setName(newSheetName );
}
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.