如何将附件保存到 Google 驱动器中根目录以外的文件夹?

How can I save attachments to folders other than the root in Google Drive?

我正在使用 google 描述的脚本 here

This Google Apps Script will automatically save Gmail attachments to Google Drive.

我更改了脚本中的一些参数,例如将触发时间更改为 1 分钟,但没有更剧烈的更改。我还创建了一个示例 Google sheet 来测试脚本。这是其中的 "copy":

A    |   B     |    C    |     D
Designate label:         |   Inbox
Destination folder:      |   GMail
Checkout label:          |   GDrive

脚本按预期工作,从收件箱中取出所有新附件并将其保存在我的 Google 驱动器(也称为我的驱动器)ROOT 下的 Gmail 文件夹中。

假设我的根目录中有一个名为 Work Files/Mails/Attachments/ 的目标文件夹,我如何修改 sheet(或者我应该修改脚本?)以保存在新的目标文件夹下?

您可以使用文件夹 ID 代替文件夹名称。

//ID -> Files/Mails/Attachments/ 
var folder = DriveApp.getFolderById("FOLDER ID");  
var file = folder.createFile(file);  

在您的 sheet 中输入您的文件夹 ID。