I have a google drive folder that receives attachments from emails via script and I want to then organize those attachments, which are from many different people, into appropriate sub folders. I'm new to the google apps api and was hoping for some direction.
Presumably, somewhere in the script there is logic like this:
var attachments = message.getAttachments();
for (var i = 0; i < attachments.length; i++) {
DriveApp.createFile(attachments[i]);
}
This saves attachments to the root folder of Google Drive. And you want is to replace it with
var attachments = message.getAttachments();
var folder = ... // somehow determine the folder to save to
for (var i = 0; i < attachments.length; i++) {
folder.createFile(attachments[i]);
}
so that the attachment is saved to some specific folder. How to determine the folder to save to is up to you.
References: