All workflows
Gmail logoBox logoGoogle Sheets logo

File emailed documents and log what they say

Files every document that arrives by email into Box and records what it says as a row on your register.

On new email in Gmail3 apps7 steps

Apps it connects

Authenticate each one once and the workflow is ready to run.

What it does

Each integration step this workflow runs, in order, what it is for, and the conditions and loops that decide when it runs.

  1. 1GmailNew email triggerWakes the workflow when a new email arrives in Gmail, optionally only from a sender you name on the trigger.
  2. 2GmailList emailsLists up to 25 inbox messages matching your search that have attachments and do not yet carry the register label.
  3. For each message

    1. 3GmailFind emailChecks that each message is still the sender's newest in the inbox, since only that one's attachments can be opened.
    2. 4GmailDownload attachmentsDownloads the attachments from the sender's latest message, keeping only PDFs as documents to file.
    3. For each attachment

      1. 5BoxUpload fileUploads each PDF into your Box folder under its original file name and keeps the link for the register.
      2. 6Google SheetsAppend rowAppends one register row per document: filed time, sender, subject, file name, Box link, read status and each extracted field.
    4. If messageFailures is at most 0 and cappedOut is not true

      1. 7GmailAdd label to messageApplies your register label to the message once every document on it is filed and logged, so it is never handled twice.

How it works

What happens on each run, in plain English.

Whenever new mail arrives in Gmail, the workflow sweeps your inbox for messages matching a search you describe, copies the PDF attachments on each into a Box folder and adds one row per document to a register in Google Sheets. The row records when it was filed, the sender, the subject, the file name, a link to the filed copy and whether it could be read, followed by details read from the document itself, such as a supplier, document number, date and total.

A field the document does not carry is left empty rather than guessed, and a document that cannot be read is still filed and still gets a row saying so. A message is labelled as registered only once every document on it is copied and logged, so a failed upload leaves the mail for the next run rather than losing a document quietly. Only PDF attachments count, so a signature logo never becomes a row.

You need a Box folder to file into and a spreadsheet tab whose column headings match that row.

gmailboxgoogle sheetsdocumentsinvoicesattachmentsfiling

Start from a workflow that already works.

Add "File emailed documents and log what they say" to your workspace, connect its apps, and make it yours. No credit card required.

Free plan available · No credit card required