[英]Google sheet Duplicatea specific sheet from a specific sheet and specific cell
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. 我希望创建一个重复的工作表,在提交表单后使用名为Template
的工作表,“ Form Response 1” =“ Yes”表示某人是否容易从名为Start
的工作表的下拉菜单中输入“ Yes”和重复项使用该单元格的名称创建了“ Template
。 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 );
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.