-1

我需要一个应用程序脚本来复制谷歌驱动器中的文件夹以及其中的谷歌文档,然后将这些副本通过电子邮件发送给某人。我已经尝试查找代码片段来完成这项工作,但我尝试的那些都没有工作。

这是我之前想出的脚本

function myFunction() {{// make copy 
doc = DocumentApp.makeCopy('example');
}
                {                                                           
GmailApp.sendEmail("example_recipient@example.com", "test", "Just a test");
               }                                        
}
4

1 回答 1

0

尝试这个:

function emailDrive() {
  var folder=DriveApp.getFolderById("id"); 
  var files=folder.getFilesByType(MimeType.GOOGLE_DOCS);
  var bA=[];
  while(files.hasNext()) {
    var file=files.next();
    bA.push(file.getBlob());
  }
  if(bA.length>0) {
    GmailApp.sendEmail('example_recipient@example.com','RE: files you requested', 'Please review and respond',{attachments:bA} )
  }
}
于 2019-04-15T18:47:52.677 回答