Saves the attachments from senders you nominate into a Google Drive folder, and labels the mail so nothing is filed twice.
Uses
Gmail
Google Drive
File email attachments into Google Drive
senders to blank.Set senders to blank.driveFolderUrl to blank.Set driveFolderUrl to blank.filedLabel to Filed to Drive.Set filedLabel to Filed to Drive.filedLines to an empty list.Set filedLines to an empty list.senders by , and save it as senderList.Split senders by , and save it as senderList.sender in senderList:For each sender in senderList:sender and save it as address.Trim sender and save it as address.address is emptyIf address is emptyYes
No
No steps
latestMatch to nothing.Set latestMatch to nothing.searchErrorIf a step below fails, save the error as searchErrorTry
address has:attachment'. Save it as latestMatch.Find email matching 'from:address has:attachment'. Save it as latestMatch.On error
address - searchError as text.Show in the output: Could not search mail from address - searchError as text.latestMessageId to blank.Set latestMessageId to blank.latestIdErrorIf a step below fails, save the error as latestIdErrorTry
latestMatch.email.id and save it as latestMessageId.Trim latestMatch.email.id and save it as latestMessageId.On error
latestMessageId to blank.Change latestMessageId to blank.latestMessageId is emptyIf latestMessageId is emptyYes
address to file.Show in the output: No mail with attachments from address to file.No
No steps
filedMatch to nothing.Set filedMatch to nothing.filedSearchErrorIf a step below fails, save the error as filedSearchErrorTry
address has:attachment label:@filedLabel'. Save it as filedMatch.Find email matching 'from:address has:attachment label:@filedLabel'. Save it as filedMatch.On error
address - filedSearchError as text.Show in the output: Could not check what has already been filed for address - filedSearchError as text.filedMessageId to blank.Set filedMessageId to blank.filedIdErrorIf a step below fails, save the error as filedIdErrorTry
filedMatch.email.id and save it as filedMessageId.Trim filedMatch.email.id and save it as filedMessageId.On error
filedMessageId to blank.Change filedMessageId to blank.latestMessageId is filedMessageIdIf latestMessageId is filedMessageIdYes
address are already in Drive.Show in the output: The latest attachments from address are already in Drive.No
No steps
downloaded to nothing.Set downloaded to nothing.downloadErrorIf a step below fails, save the error as downloadErrorTry
latestMessageId. Save it as downloaded.Download the attachments on email latestMessageId. Save it as downloaded.On error
address - downloadError as text.Show in the output: Could not download the attachments from address - downloadError as text.savedFromSender to 0.Set savedFromSender to 0.attachment in downloaded.documents:For each attachment in downloaded.documents:attachmentRef to blank.Set attachmentRef to blank.referenceErrorIf a step below fails, save the error as referenceErrorTry
attachment.document_ref and save it as attachmentRef.Trim attachment.document_ref and save it as attachmentRef.On error
attachmentRef to blank.Change attachmentRef to blank.attachmentRef is emptyIf attachmentRef is emptyYes
address because it was not stored and cannot be uploaded.Show in the output: Skipped an attachment from address because it was not stored and cannot be uploaded.No
No steps
attachmentName to attachment.Set attachmentName to attachment.nameErrorIf a step below fails, save the error as nameErrorTry
attachment.filename and save it as attachmentName.Trim attachment.filename and save it as attachmentName.On error
attachmentName to attachment.Change attachmentName to attachment.attachmentName is emptyIf attachmentName is emptyYes
attachmentName to attachment.Change attachmentName to attachment.No
No steps
attachmentType to application/octet-stream.Set attachmentType to application/octet-stream.typeErrorIf a step below fails, save the error as typeErrorTry
attachment.content_type and save it as attachmentType.Trim attachment.content_type and save it as attachmentType.On error
attachmentType to application/octet-stream.Change attachmentType to application/octet-stream.attachmentType is emptyIf attachmentType is emptyYes
attachmentType to application/octet-stream.Change attachmentType to application/octet-stream.No
No steps
saved to nothing.Set saved to nothing.uploadErrorIf a step below fails, save the error as uploadErrorTry
attachmentRef. Save it as saved.Upload file attachmentRef. Save it as saved.On error
attachmentName from address to Drive - uploadError as text.Show in the output: Could not save attachmentName from address to Drive - uploadError as text.savedFromSender.Add 1 to savedFromSender.savedLink to blank.Set savedLink to blank.linkErrorIf a step below fails, save the error as linkErrorTry
saved.upload_link and save it as savedLink.Trim saved.upload_link and save it as savedLink.On error
savedLink to blank.Change savedLink to blank.filedLine to attachmentName from address.Set filedLine to attachmentName from address.savedLink isn't emptyIf savedLink isn't emptyYes
filedLine to filedLine - savedLink.Change filedLine to filedLine - savedLink.No
No steps
filedLine to the end of filedLines and save it as filedLines.Add filedLine to the end of filedLines and save it as filedLines.savedFromSender is greater than 0If savedFromSender is greater than 0Yes
labelErrorIf a step below fails, save the error as labelErrorTry
filedLabel to email latestMessageId.Add label filedLabel to email latestMessageId.On error
address but could not label the email, so they may be filed again on the next run.Show in the output: Filed the attachments from address but could not label the email, so they may be filed again on the next run.No
address were saved this time.Show in the output: No attachments from address were saved this time.filedLines is emptyIf filedLines is emptyYes
Nothing new to file - the latest attachments from every sender are already in Drive..Show in the output: Nothing new to file - the latest attachments from every sender are already in Drive..No
filedLines as text attachment(s) into Drive:Show in the output: Filed the length of filedLines as text attachment(s) into Drive:
filedLines joined by a new line.