[英]Google sheet Duplicatea specific sheet from a specific sheet and specific cell
我希望創建一個重復的工作表,在提交表單后使用名為Template
的工作表,“ Form Response 1” =“ Yes”表示某人是否容易從名為Start
的工作表的下拉菜單中輸入“ Yes”和重復項使用該單元格的名稱創建了“ Template
。 我嘗試使用下面的代碼,但希望您能使用簡單的說明。
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);
}
您的問題尚不清楚您到底要實現什么目標。
我寫了幾行代碼,可能會對您有所幫助。
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.