Saves the attachments from senders you nominate into a Google Drive folder, and labels the mail so nothing is filed twice.

UsesGmailGoogle Drive

File email attachments into Google Drive

ScheduleRun every hour.Run every hour.
ValuesSet senders to blank.Set senders to blank.
ValuesSet driveFolderUrl to blank.Set driveFolderUrl to blank.
ValuesSet filedLabel to Filed to Drive.Set filedLabel to Filed to Drive.
ValuesSet filedLines to an empty list.Set filedLines to an empty list.
TextSplit senders by , and save it as senderList.Split senders by , and save it as senderList.
Decisions & LoopsFor each sender in senderList:For each sender in senderList:
TextTrim sender and save it as address.Trim sender and save it as address.
Decisions & LoopsIf address is emptyIf address is empty
Yes
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ValuesSet latestMatch to nothing.Set latestMatch to nothing.
Decisions & LoopsIf a step below fails, save the error as searchErrorIf a step below fails, save the error as searchError
Try
GmailGmailFind email matching 'from:address has:attachment'. Save it as latestMatch.Find email matching 'from:address has:attachment'. Save it as latestMatch.
On error
ValuesShow in the output: Could not search mail from address - searchError as text.Show in the output: Could not search mail from address - searchError as text.
Decisions & LoopsSkip to the next item.Skip to the next item.
ValuesSet latestMessageId to blank.Set latestMessageId to blank.
Decisions & LoopsIf a step below fails, save the error as latestIdErrorIf a step below fails, save the error as latestIdError
Try
TextTrim latestMatch.email.id and save it as latestMessageId.Trim latestMatch.email.id and save it as latestMessageId.
On error
ValuesChange latestMessageId to blank.Change latestMessageId to blank.
Decisions & LoopsIf latestMessageId is emptyIf latestMessageId is empty
Yes
ValuesShow in the output: No mail with attachments from address to file.Show in the output: No mail with attachments from address to file.
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ValuesSet filedMatch to nothing.Set filedMatch to nothing.
Decisions & LoopsIf a step below fails, save the error as filedSearchErrorIf a step below fails, save the error as filedSearchError
Try
GmailGmailFind email matching 'from:address has:attachment label:@filedLabel'. Save it as filedMatch.Find email matching 'from:address has:attachment label:@filedLabel'. Save it as filedMatch.
On error
ValuesShow in the output: Could not check what has already been filed for address - filedSearchError as text.Show in the output: Could not check what has already been filed for address - filedSearchError as text.
Decisions & LoopsSkip to the next item.Skip to the next item.
ValuesSet filedMessageId to blank.Set filedMessageId to blank.
Decisions & LoopsIf a step below fails, save the error as filedIdErrorIf a step below fails, save the error as filedIdError
Try
TextTrim filedMatch.email.id and save it as filedMessageId.Trim filedMatch.email.id and save it as filedMessageId.
On error
ValuesChange filedMessageId to blank.Change filedMessageId to blank.
Decisions & LoopsIf latestMessageId is filedMessageIdIf latestMessageId is filedMessageId
Yes
ValuesShow in the output: The latest attachments from address are already in Drive.Show in the output: The latest attachments from address are already in Drive.
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ValuesSet downloaded to nothing.Set downloaded to nothing.
Decisions & LoopsIf a step below fails, save the error as downloadErrorIf a step below fails, save the error as downloadError
Try
GmailGmailDownload the attachments on email latestMessageId. Save it as downloaded.Download the attachments on email latestMessageId. Save it as downloaded.
On error
ValuesShow in the output: Could not download the attachments from address - downloadError as text.Show in the output: Could not download the attachments from address - downloadError as text.
Decisions & LoopsSkip to the next item.Skip to the next item.
ValuesSet savedFromSender to 0.Set savedFromSender to 0.
Decisions & LoopsFor each attachment in downloaded.documents:For each attachment in downloaded.documents:
ValuesSet attachmentRef to blank.Set attachmentRef to blank.
Decisions & LoopsIf a step below fails, save the error as referenceErrorIf a step below fails, save the error as referenceError
Try
TextTrim attachment.document_ref and save it as attachmentRef.Trim attachment.document_ref and save it as attachmentRef.
On error
ValuesChange attachmentRef to blank.Change attachmentRef to blank.
Decisions & LoopsIf attachmentRef is emptyIf attachmentRef is empty
Yes
ValuesShow in the output: Skipped an attachment from 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.
Decisions & LoopsSkip to the next item.Skip to the next item.
No
No steps
ValuesSet attachmentName to attachment.Set attachmentName to attachment.
Decisions & LoopsIf a step below fails, save the error as nameErrorIf a step below fails, save the error as nameError
Try
TextTrim attachment.filename and save it as attachmentName.Trim attachment.filename and save it as attachmentName.
On error
ValuesChange attachmentName to attachment.Change attachmentName to attachment.
Decisions & LoopsIf attachmentName is emptyIf attachmentName is empty
Yes
ValuesChange attachmentName to attachment.Change attachmentName to attachment.
No
No steps
ValuesSet attachmentType to application/octet-stream.Set attachmentType to application/octet-stream.
Decisions & LoopsIf a step below fails, save the error as typeErrorIf a step below fails, save the error as typeError
Try
TextTrim attachment.content_type and save it as attachmentType.Trim attachment.content_type and save it as attachmentType.
On error
ValuesChange attachmentType to application/octet-stream.Change attachmentType to application/octet-stream.
Decisions & LoopsIf attachmentType is emptyIf attachmentType is empty
Yes
ValuesChange attachmentType to application/octet-stream.Change attachmentType to application/octet-stream.
No
No steps
ValuesSet saved to nothing.Set saved to nothing.
Decisions & LoopsIf a step below fails, save the error as uploadErrorIf a step below fails, save the error as uploadError
Try
Google DriveGoogle DriveUpload file attachmentRef. Save it as saved.Upload file attachmentRef. Save it as saved.
On error
ValuesShow in the output: Could not save attachmentName from address to Drive - uploadError as text.Show in the output: Could not save attachmentName from address to Drive - uploadError as text.
Decisions & LoopsSkip to the next item.Skip to the next item.
ValuesAdd 1 to savedFromSender.Add 1 to savedFromSender.
ValuesSet savedLink to blank.Set savedLink to blank.
Decisions & LoopsIf a step below fails, save the error as linkErrorIf a step below fails, save the error as linkError
Try
TextTrim saved.upload_link and save it as savedLink.Trim saved.upload_link and save it as savedLink.
On error
ValuesChange savedLink to blank.Change savedLink to blank.
ValuesSet filedLine to attachmentName from address.Set filedLine to attachmentName from address.
Decisions & LoopsIf savedLink isn't emptyIf savedLink isn't empty
Yes
ValuesChange filedLine to filedLine - savedLink.Change filedLine to filedLine - savedLink.
No
No steps
ListsAdd filedLine to the end of filedLines and save it as filedLines.Add filedLine to the end of filedLines and save it as filedLines.
Decisions & LoopsIf savedFromSender is greater than 0If savedFromSender is greater than 0
Yes
Decisions & LoopsIf a step below fails, save the error as labelErrorIf a step below fails, save the error as labelError
Try
GmailGmailAdd label filedLabel to email latestMessageId.Add label filedLabel to email latestMessageId.
On error
ValuesShow in the output: Filed the attachments from 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
ValuesShow in the output: No attachments from address were saved this time.Show in the output: No attachments from address were saved this time.
Decisions & LoopsIf filedLines is emptyIf filedLines is empty
Yes
ValuesShow in the output: 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
ValuesShow in the output: Filed the length of 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.