如何从函数参数google脚本创建文件夹

时间:2017-09-14 16:39:38

标签: javascript jquery forms google-apps-script google-drive-api

如何从函数参数创建文件夹 示例

 function uploadFileToGoogleDrive(data, file,namaf) {
 try {
 namafolder=namaf;
 createFolder([namafolder];
 }
 }

不是从像

这样的变量创建的
var name ="Myfoldernanme";
var newfolder = folder.createFolder(name);

1 个答案:

答案 0 :(得分:0)

DocsList和DriveApp的组合非常有用。

/* CODE FOR DEMONSTRATION PURPOSES */
function main() {
  var parentFolder = DocsList.getFolder('September 2017');
  var idNewFolder = parentFolder.createFolder('New Folder').getId();
  var newFolder = DriveApp.getFolderById(idNewFolder);
  newFolder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT);
}