Block 1 - Gmail Trigger
- Type / Role
- n8n-nodes-base.gmailTrigger - gmailTrigger
- Config choices
- Version 1.2
This workflow is provided as-is. Please review and test before using in production.
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...
n8n-nodes-base.gmailtrigger, n8n-nodes-base.googledrive, n8n-nodes-base.splitout, n8n-nodes-base.stickynote, n8n-nodes-base.switch, n8n-nodes-base.noop
This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Hubschrauber.
Original n8n.io sourceThis 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.
Split Out instead of CodeThe “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.
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.{{ $binary.values()[0].fileName }}{{ $binary.values()[0].fileExtension }}{{ $binary.values()[0].fileType }}{{ $binary.values()[0].fileSize }}{{ $binary.values()[0].fileSize.split(' ')[0].toNumber() }}{{ $binary.values()[0].mimeType }}{{ $binary.values()[0].id }}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.
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.
| 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 |
Use the JSON export at /data/workflows/2966/2966.json as the source template for this automation.
Open n8n, import the downloaded JSON, and review each node before activating the workflow.
Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.
Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.
Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.
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.
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...
Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.
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.