Finance & Ops · n8n

Automatically Save Gmail Attachments to Google Drive for Freelancers

Every time a new email with an attachment arrives in Gmail, this workflow automatically saves the file to a specified Google Drive folder. Freelancers never lose a contract, invoice, or brief again.

difficulty Beginnersetup 30 minresult Every Gmail attachment is instantly and automatically saved to a designated Google Drive folder, creating a reliable archive without any manual effort.
  1. 1

    Trigger: Watch Gmail for new emails with attachments

    Add a Gmail Trigger node. Connect it to your Google account via OAuth2 credentials. Set Event to New Attachment. This node polls your inbox and fires whenever an email arrives that includes at least one attachment. You can optionally set a label filter (e.g. INBOX) in the Filters section to narrow which emails are monitored.

  2. 2

    Filter: Confirm the email actually has an attachment

    Add an IF node connected to the Gmail Trigger. In the condition, check that {{$json["attachments"].length}} is greater than 0. Route the true branch forward. This prevents the workflow from erroring on trigger misfires. The false branch can be left unconnected.

  3. 3

    Prepare: Extract and name the attachment data

    Add a Set node after the true branch of the IF node. Create a field called fileName with value {{$json["attachments"][0]["name"]}} and a field called fileData with value {{$json["attachments"][0]["content"]}}. This isolates the first attachment's name and base64 content so the Drive node can consume them cleanly.

  4. 4

    Save: Upload the file to Google Drive

    Add a Google Drive node set to the Upload operation. Connect it to your Google account via OAuth2 credentials. Set File Name to {{$json["fileName"]}}, set Binary Property or File Content to {{$json["fileData"]}}, and set Parents to the ID of the Drive folder where you want files saved (copy the folder ID from the Drive URL). Enable Convert to Binary if prompted so n8n handles the base64 correctly.

Frequently asked questions

What if an email has multiple attachments — will all of them be saved?

The basic workflow saves only the first attachment per email. To handle multiple attachments you would add a `Split In Batches` or `Loop` node to iterate over the attachments array. For most freelancers receiving single-file emails (invoices, contracts, briefs) the default setup covers the common case.

How do I find the Google Drive folder ID to paste into the node?

Open the destination folder in Google Drive in your browser. Look at the URL — it will look like `https://drive.google.com/drive/folders/1aBcDeFgHiJkL`. The long string of characters after `/folders/` is the folder ID. Copy and paste that into the `Parents` field of the Google Drive node.

Will this workflow save attachments from emails I already received, or only new ones going forward?

The Gmail Trigger only watches for new incoming emails from the moment the workflow is activated. It does not process emails that arrived before activation. If you need to backfill old attachments, you can temporarily switch to a Gmail node (not trigger) and search by date range, then run it manually once.

About this recipe. Recipes on FlowRecipesHub are written for business owners, not developers, and are tested before publishing — how recipes get made. Some ingredient links are affiliate links that cost you nothing — full disclosure.