Skip to main content

Upload multiple attachments from Gmail to Google Drive - without a code node

Workflow preview

Workflow preview
100%
Upload multiple attachments from Gmail to Google Drive - without a code node preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Summary This template uses the item handling nodes, and expression support in n8n, without using a node , to extract multiple attachments from a GMail (trigger input) message/event, and (conditiona...

Best for

  • File Management automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.gmailtrigger, n8n-nodes-base.googledrive, n8n-nodes-base.splitout, n8n-nodes-base.stickynote, n8n-nodes-base.switch, n8n-nodes-base.noop

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Hubschrauber.

Original n8n.io source

1.1 Workflow description

Title
Upload multiple attachments from Gmail to Google Drive - without a code node
Workflow name
Upload multiple attachments from Gmail to Google Drive - without a code node

Summary

This template uses the item handling nodes, and expression-support in n8n, without using a Code node, to extract multiple attachments from a GMail (trigger input) message/event, and (conditionally) upload each of them to Google Drive.

Note: There is another template titled Get Multiple Attachments from Gmail and upload them to GDrive that does basically the same thing, but it uses a Code node.

Details

Using Split Out instead of Code

The “secret” to how this works is that n8n supports a special input field name $binary that references the entire set of (multiple) binary data sub-elements in a single input item. It may look like an expression, but in this case it is a “fixed” (literal) value used as the Fields to Split Out parameter value.

Dealing with names that are prefixed/suffixed with an Index

The next challenge with multiple attachments from a GMail message is that each one is still assigned different name like "attachment_0", "attachment_1", etc. This makes it tricky to reference them in a generic way. However, once n8n splits the items out, the binary in each item is always the first (i.e. index-zero / [0]) and ONLY key/value. So, that makes it possible get the key-name and attributes of the corresponding value indirectly with some clever expression syntax.

  • Input Data Field Name -> Expression: {{ $binary.keys()[0] }} - This returns the name, regardless of whether it is "attachment_0", "attachment_1", or whatever else.
  • Attachment file name: -> Expression: {{ $binary.values()[0].fileName }}
  • Attachment file name extension: -> Expression: {{ $binary.values()[0].fileExtension }}
  • Attachment file type: -> Expression: {{ $binary.values()[0].fileType }}
  • Attachment file size (e.g. string "100 kB"): -> Expression: {{ $binary.values()[0].fileSize }}
  • Attachment file size (numeric): -> Expression: {{ $binary.values()[0].fileSize.split(' ')[0].toNumber() }}
  • Attachment mime type: -> Expression: {{ $binary.values()[0].mimeType }}
  • Attachment id (storage GUID): -> Expression: {{ $binary.values()[0].id }}

Flow Control

Since each of the attachments becomes a single item, it is relatively straightforward to introduce other n8n nodes like If, Switch, or Filter and route each single attachment item into different workflow paths. The template demonstrates how each attachment binary could be routed based on its file size, as an example.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Gmail Trigger

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 2 - Google Drive

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 3 - Split Out

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 4 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 5 - Switch

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 6 - Sticky Note1

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 7 - Send " Too Big" Notification (for example)

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 8 - Ignore Little Graphics / Icons (for example)

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

3. Summary Table

Workflow Upload multiple attachments from Gmail to Google Drive - without a code node
Complexity intermediate
Nodes 8
Categories File Management
Author Hubschrauber
Published 21 Feb 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/2966/2966.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Upload multiple attachments from Gmail to Google Drive - without a code node do?

Summary This template uses the item handling nodes, and expression support in n8n, without using a node , to extract multiple attachments from a GMail (trigger input) message/event, and (conditiona...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your File Management use case.