亲爱的,我有一个使响应输出文件夹“ MURAD”的表单我想将此MURAD更改为'rowContents
'
where
var rowContents=sheet.getRange(lastRow,1,1,sheet.getLastColumn()).getValues()
;
脚本是
function myFunction() {
var ss=SpreadsheetApp.getActiveSpreadsheet();
var sheet=ss.getActiveSheet();
var lastRow=ss.getLastRow();
//the first column contains the timestamp
var department=sheet.getRange(lastRow,2).getValue();
//----------------------------------------------------------------------
var subjectCode=sheet.getRange(lastRow,3).getValue();
var courseCode=sheet.getRange(lastRow,4).getValue();
var courseNo=sheet.getRange(lastRow,5).getValue();
//var newResponse=subjectCode.toString()+"-"+courseCode.toString()+"-"+courseNo.toString();
//here the new column with the file name is going on
var newResponse=courseCode.toString()+courseNo.toString();
//-----------------------------------------------------------------------
sheet.getRange(lastRow,7).setValue(newResponse);
var secodarySheetId;
switch(department) {
case "Physics":
secodarySheetId="1k2rOZfXjXHciPQh1pXn7-GP-p3rccMgT";//Paste here the Id of the destinationsheet in the Physics folder
break;
case "Chemistry":
secodarySheetId="16-TOKctf8Y7nHyYFK8OgNIMCd9YQFvRT";//Paste here the Id of the destinationsheet in the Chemistry folder
break;
case "Math":
secodarySheetId="1aPXI357UfQGdJnoxYfvtSq7GXhfizSSC";//Paste here the Id of the destinationsheet in the Maths folder
break;
}
// var files=DriveApp.getFolderById(secodarySheetId).getFiles();
//while(files.hasNext())
//{
// Logger.log(files.next())
//}
//DriveApp.createFolder(secodarySheetId)
var rowContents=sheet.getRange(lastRow,1,1,sheet.getLastColumn()).getValues();
var folders = DriveApp.getRootFolder().searchFolders('AlulaCR');
while (folders.hasNext()) {
var folder = folders.next();
Logger.log(folder.getName());
}}
function changeFolderName(oldName) {
var oldName=oldName||"MURAD";
var folders=DriveApp.getFoldersByName("MURAD");
var ss=SpreadsheetApp.getActive();
var sh=ss.getActiveSheet();
var rowContents=sh.getRange(sh.getLastRow(),1,1,sh.getLastColumn()).getValues()[0];
var n=0;
while(folders.hasNext()) {
var folder=folders.next();
n++;
}
if(n==1 && rowContents[?]) {//dont know which one you want
var ss=SpreadsheetApp.getActive();
var sh=ss.getActiveSheet();
folder.setName(rowContents[?]);//Dont know which one you want
}else{
SpreadsheetApp.getUi().alert("Need Help. Found more than one folder with that name or invalid new name.");
}
}