Save email attachments to Google Drive automatically
Detect Gmail attachments, sort them into folders, upload to Google Drive, and optionally log the file — an n8n workflow you can import.
Intermediate·~40 min·9 nodes
n8n · Gmail · Google Drive · OpenAI · Airtable
Property Management · Real Estate · Accounting · Professional Services·Operations · Administration · Document Processing · Finance
What this automation does
Instead of downloading every PDF from Gmail and dragging it into the right Drive folder, this workflow watches incoming mail, splits each attachment, guesses a category, creates the year/month/type folder if needed, and uploads the file. An optional Airtable row keeps a searchable log.
When to use it
Use this workflow if:
- Invoices, contracts, or IDs arrive by email and live in someone’s inbox.
- The shared Drive is missing files because filing is manual.
- Property, accounting, or ops teams need a predictable folder tree.
- You want a log of what arrived, from whom, and where the file now sits.
- Attachments are easy to miss when the rest of the thread is noise.
Workflow overview
Trigger
Gmail reports a new message and can download binaries.
Validate
Messages with no attachments stop immediately.
Process
Each file becomes its own item with a safe filename.
Decision
A category is taken from the name or from an optional AI step.
Action
Drive folders are ensured, then the file is uploaded.
Notification
Airtable can log the file; Slack can be added if you want a ping.
Interactive flow
Pan, zoom, and click a node to inspect it. Use the buttons below the canvas to jump to a step.
n8n workflow JSON
Copy this workflow JSON and import it directly into n8n. You will still need to connect your own credentials and configure the services used by the workflow.
Import this workflow into n8n
- Copy or download the workflow JSON from this page.
- Open n8n and create a new workflow — or open an empty canvas.
- Use Import from File, or paste the JSON via the workflow menu.
- Connect your own credentials for every service the workflow uses.
- Replace the placeholder IDs, channels, tables, and folder names.
- Run a test with a sample payload before you activate it.
- Activate the workflow only after the test run looks correct.
Setup requirements
Accounts
- n8n
- Gmail
- Google Drive
- OpenAI (optional — disable Classify Document if unused)
- Airtable (optional — disable the log node if unused)
Credentials
- Gmail OAuth
- Google Drive OAuth
- OpenAI credential if you keep the classifier
- Airtable token if you keep the log
Information
- Root Google Drive folder ID (YOUR_DRIVE_FOLDER_ID)
- Whether you want year/month/category folders or a flatter tree
- Airtable Documents table fields, if logging
- Which Gmail label or inbox should be watched
Step-by-step
Step 1 — Watch incoming mail
The Gmail Trigger should download attachments. If binaries are missing on the first run, add a Gmail Get Message node with download enabled.
Step 2 — Skip empty messages
The IF node continues only when the item has binary files, so ordinary replies do not create empty folders.
Step 3 — Split and name files
Code emits one item per attachment, with a sanitized filename and a first-pass category from the name or MIME type.
Step 4 — Classify the document
Optional OpenAI step refines invoice vs receipt vs contract vs other. Disable Classify Document and Apply Category if filename rules are enough.
Step 5 — File in Drive
A folder is created (or reused) under your root ID, then the binary is uploaded. Confirm the binary property name matches what Split Attachments emitted.
Step 6 — Log the document
Airtable stores filename, category, sender, and Drive id. Disable this node if Drive is the only system of record.
Ways to extend this workflow
- Disable the OpenAI nodes and keep filename-based categories only.
- Notify Slack or WhatsApp when an invoice lands in Drive.
- Extract totals from PDFs with a parser before the Airtable log.
- Route contracts to a review folder instead of the live archive.
- Match the sender domain to a client record in your CRM.
- Deduplicate by filename plus date so forwards do not upload twice.
- Swap Airtable for a property-management system or QuickBooks Online attachment.
Need this customized for your business?
This template is the starting point. If the workflow needs custom logic, several systems, error handling, or production monitoring, Syntropic Ops can design and implement it with you.