Olmec Dynamics
H
·6 min read

How to Automatically Upload and Rename Gmail Attachments in Google Drive Using Make.com

Connect Gmail to Google Drive in Make.com to upload attachments, rename files from the email subject, and log results in Sheets reliably.

Introduction

If you routinely receive invoices, proposals, or signed documents by email, you already know the pain. Attachments land in Gmail, filenames are inconsistent, and someone has to manually download, rename, and file them into Google Drive. After a few weeks, searching becomes archaeology.

This is an end-to-end Cross-Platform Automation (XPA) that automatically uploads Gmail attachments into the right Google Drive location and renames the files based on the email subject. You will also write a quick log so you can audit what ran.

By the end, you will know how to connect Gmail, Google Drive, and Make.com, build a safe filename template, and avoid overwriting files.

What You'll Need

  • Make.com account, paid plan is usually required for scheduled runs and for building a multi-step scenario
  • Gmail connection in Make.com with permission to read emails and attachments
  • Google Drive connection in Make.com with permission to upload to your target folder
  • Google Sheets connection (recommended) for logging successes and failures
  • A target Google Drive folder, for example: Gmail Attachments

Permissions and gotchas:

  • Use OAuth connections created inside Make.com, make sure the connected Google account owns the target Drive folder.
  • Filter the trigger using a Gmail label or a Gmail search query, so you only capture the emails you actually want.

How It Works (The Logic)

When Make.com detects a new Gmail message with attachments (trigger), it iterates through each attachment (per-email, per-attachment handling). For each attachment, it builds a filename using the email subject plus the original attachment name, then uploads the file into your Google Drive folder with that constructed filename. Finally, it writes a row into Google Sheets so you can track what happened.

This is a straightforward XPA pattern: trigger in Gmail → transform filename → upload in Drive → log in Sheets.

Step-by-Step Setup

1) Create a new Make.com scenario

  1. In Make.com, create a new scenario.
  2. Name it something clear like: Gmail attachments to Drive (rename by subject).

2) Add the Gmail trigger

  1. Add a Gmail module as the first module.
  2. Choose a “watch for new emails” style trigger that runs when new messages arrive.
  3. Configure filters so you only pull what you want:
    • Filter by label (recommended), for example To-Drive Archive
    • Or use a narrowed search query like has:attachment plus any extra constraints

Common gotcha: if you start with an overly broad query, you will quickly fill a Drive folder with junk attachments and then have to clean up.

3) Ensure you have subject, message id, and attachment data

You need these downstream fields:

  • Email subject
  • Email date (optional, but useful for sorting and naming)
  • Gmail message id (highly useful for idempotency)
  • Attachment original filename
  • Attachment content (or a way to fetch it)

If your trigger output does not include attachment details, add a second Gmail step to fetch the message details and expose the attachments array.

4) Iterate through attachments

  1. Add an Iterator module.
  2. Point it at the attachments array coming from the Gmail step.

This makes the scenario upload one file per attachment, not one upload per email.

5) Build the filename from the email subject

Add a Set variable and build the filename string before upload.

A practical starting template:

  • YYYY-MM-DD - {Sanitized Subject} - {Original Attachment Name}

Filename sanitization rules you should apply:

  • Replace invalid filename characters in common file systems: / \\ ? % * : | " < > with _
  • Collapse multiple spaces to a single space
  • Trim the sanitized subject portion to a safe length (for example 100 to 120 characters)

Collision handling (recommended): append a short message id suffix, for example:

  • ... - {Original Attachment Name} - {messageIdSuffix}

This stops overwrite problems when two emails have the same subject.

6) Upload to Google Drive using the new name

  1. Add a Google Drive module for file upload.
  2. Set:
    • Destination folder: your Gmail Attachments folder (or a subfolder)
    • File name: your constructed filename from Step 5
    • File content: the current attachment content from the Iterator

Common gotcha: if you omit a uniqueness suffix (message id suffix), repeated runs or similar emails can create duplicates or trigger upload errors.

7) Log results to Google Sheets

  1. Add a Google Sheets module to append a row after each upload.
  2. Log fields like:
    • Timestamp
    • Gmail message id
    • Email subject
    • Attachment original filename
    • Final Drive filename
    • Status: success

For failures, route errors from the upload module to a separate route that appends a Sheets row with:

  • Status: failed
  • Error message text (or Make.com error output)

8) Add basic routing for errors

Make your scenario debuggable:

  • Create an error handler route connected to the failing module.
  • In that route, write the context (message id, subject, attachment name, target folder) into Google Sheets.

9) Test with one email, then enable the schedule

  1. Test with a single email that has one attachment.
  2. Confirm:
    • The Drive filename matches your template
    • The file lands in the correct folder
    • Sheets logs the outcome
  3. Turn on the scenario schedule or watch mode.

Real-World Business Scenario

A procurement firm receives supplier invoices via email. They were spending 30 to 40 minutes a week downloading attachments, renaming them so they matched internal naming rules, and filing them into Google Drive.

With this Make.com XPA:

  • Every inbound invoice with attachments lands in Gmail with a consistent subject pattern.
  • Attachments automatically upload into Gmail Attachments/Invoices.
  • Filenames become 2026-05-13 - Invoice INV-10421 - ACME Supplies - invoice.pdf - 4f2a9c.
  • Their admin team can sort and search in Drive immediately, while the Sheets log provides an audit trail for finance.

Common Variations

  1. Use Gmail labels instead of broad searches

    • Only process messages with a label like To-Drive Archive, so you do not ingest newsletters or internal threads.
  2. Create subfolders by year or subject keyword

    • After you sanitize the subject, set the Drive destination folder dynamically, for example /Gmail Attachments/2026/Invoices.
  3. Add a hard filter for sender or attachment type

    • Only upload PDFs from finance@ suppliers, skip everything else.

If you want to understand the bigger XPA patterns across systems, this Cross-Platform Automation (XPA) overview is a good starting point.

Working set you now have in place

You built a simple Gmail to Google Drive automation in Make.com that uploads each attachment, renames it based on the email subject, and records outcomes in Google Sheets. That removes the repetitive download and rename work, and it gives you an audit trail when something breaks.

Olmec Dynamics builds these kinds of XPAs for teams who want fewer manual steps and cleaner operational data. If you want us to tailor the trigger filters, filename rules, and folder structure to your exact email patterns, see what we do here.