This script will look for attachments in Gmail Message and Extract it to a Google Drive folder. Script can be run manually or through a time driven trigger. The script can be personalized by following the instructionsgiven in this article.
This procedure can be followed with any Gmail account. Once the installation is complete, script will run as per the specified interval, look for messages in Gmail which are not labelled and have attachments as file types specified. It will extract the attachment to a Google Drive folder and label the Gmail Message 'GmailToDrive'.
var fileTypesToExtract = ['jpg', 'tif', 'png', 'gif', 'bmp', 'svg'];
This is an array for file types to look for. You may add or remove file types from this array.
var folderName = 'GmailToDrive';This is the name of the folder to which files will be extracted to in Google Drive. If the script does not finds a folder with this name, it will create the folder in drive.
var labelName = 'GmailToDrive'; This label name is Gmail Label name. This is used by the script to identify which message has been processed and which has not not. Once a message is processed, script will put a label on those messages with below name. You may change the label name too.