Olmec Dynamics
H
·7 min read

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

Automate uploading Gmail attachments to Google Drive, rename files with sender and date, and log links in Google Sheets using Make.com.

Introduction

If your team still handles attachments by hand, the workflow usually looks like this: someone opens an email, downloads the file, renames it, uploads it to Drive, then emails a link to the next person. It works until you get messy filenames, missing attachments, or “where is that doc?” questions two weeks later.

In this guide you will build a Cross-Platform Automation (XPA) that watches a Gmail label for incoming messages, uploads every attachment to the right Google Drive folder, renames each file based on sender, email date, and subject, and writes a clean log row to Google Sheets.

By the end, you will know exactly how to wire Gmail to Google Drive in Make.com, plus the gotchas that prevent duplicate uploads and broken filenames.

What You'll Need

  • Gmail: a dedicated label to target only the emails you want processed (for example, To-Archive-Drive)
  • Make.com: a scenario runner with connections to Gmail and Google Drive. A paid Make.com plan is recommended if you have high volume or need reliability under webhook-like retries.
  • Google Drive: a target folder (or folder structure) where you want attachments stored
  • Google Sheets: a spreadsheet to log uploads (message ID, attachment name, Drive link, timestamps)
  • Permissions: Make.com must have edit access to the target Drive folder and edit access to the log spreadsheet

How It Works (The Logic)

When a new Gmail message arrives with your chosen label (trigger), Make.com reads the message metadata (sender, date, subject) and iterates through the attachments (action). For each attachment, it uploads the binary to Google Drive (action), renames it deterministically using the metadata plus the original file extension (action), and then writes a row into Google Sheets (action).

The critical reliability piece is idempotency. You generate a dedupe key per attachment so retries or accidental re-runs do not create duplicate files.

Trigger (Gmail label) → Extract email metadata → Build upload filenames → Deduplicate check → Upload to Drive → Log upload to Sheets

Step-by-Step Setup

1) Create the Gmail label and narrow the email selection

  1. In Gmail, create a label like To-Archive-Drive.
  2. Add a Gmail filter so only the emails you actually want archived get that label.

Common filter examples:

Gotcha: Gmail threads get labeled for the whole conversation. If you receive replies within the same thread, your filter can pull “attachment replies” unexpectedly. Keep your filter as narrow as you can, and if possible include “has attachment” and a state like “unread”.

2) Create a Google Sheets upload log

Create a sheet (example name: Drive Upload Log) with columns:

  • dedupe_key (text, unique)
  • email_message_id (text)
  • attachment_name_original (text)
  • drive_file_id (text)
  • drive_file_link (text)
  • uploaded_at (datetime)
  • status (optional, like uploaded or skipped)

Tip: treat dedupe_key as the only thing that matters for “already uploaded”. Don’t dedupe on filename alone, because renamed duplicates will look different.

3) Choose a deterministic filename pattern

Use a pattern that is stable and sortable:

{yyyy-mm-dd}_{sender_slug}_{subject_slug}{att_index}_{original_extension}

Example: 2026-06-08_jane-smith_client-onboarding_att1.pdf

Rules:

  • sender_slug: lowercased, spaces replaced with hyphens, strip unsupported filename characters
  • subject_slug: collapse whitespace, strip punctuation that creates unsafe filenames
  • att_index: if multiple attachments exist, append _att1, _att2, etc.
  • preserve the original extension, like .pdf, .docx, .png

Gotcha: if the extension is missing in the Gmail attachment metadata, Decide what you will do (skip, or map by MIME type if Make exposes it).

4) Build the Make.com scenario

In Make.com, create a new Scenario:

  1. Module 1: Gmail trigger

    • Trigger: a “Watch emails” style module
    • Configure it to only watch the label To-Archive-Drive
    • Ensure the output includes attachments (connector options vary, but you need the attachment binary in the scenario)
  2. Module 2: Tools for normalization

    • Use Formatter / Set variables modules to extract:
      • email_message_id
      • from_name and/or from_email (use one consistently)
      • subject
      • received_at or message date
    • Generate:
      • sender_slug
      • subject_slug
      • date_yyyy_mm_dd

5) Add idempotency (dedupe) before uploading

You need a dedupe key that changes per attachment.

Recommended dedupe key:

  • dedupe_key = email_message_id + "|" + attachment_original_filename + "|" + att_index

Then in Make.com:

  1. Add Google Sheets: Search rows for dedupe_key.
  2. Use a Router:
    • If found: skip upload
    • If not found: proceed to upload

This prevents duplicates when Gmail redelivers or Make retries.

6) Upload each attachment to Google Drive

For the upload branch:

  1. Module: Google Drive upload file
    • File content: the Gmail attachment binary
    • Destination: your target folder
    • Filename: set it to your deterministic pattern, including the extension

If the upload module cannot reliably set the final filename in your connector version, use a two-step approach:

  • Upload with a temporary name
  • Follow with a “Rename file” step

7) Log the Drive file link to Google Sheets

After a successful upload:

  1. Module: Google Sheets Add a row
  2. Map:
    • dedupe_key
    • email_message_id
    • attachment_name_original
    • drive_file_id
    • drive_file_link (construct from the Drive file ID if needed)
    • uploaded_at (use Make’s timestamp)

8) Mark the email as processed only after success

Add a final Gmail action in the success path:

  • remove the To-Archive-Drive label, or
  • apply a Processed label, or
  • mark as read

Do this after the upload and logging steps complete. If you remove the label too early and the Drive upload fails, you will create a “missing archive” situation.

Real-World Business Scenario

A legal operations team uses this XPA to archive inbound contract attachments. Incoming emails get a To-Archive-Drive label. Make.com uploads every attachment into a shared Drive folder using filenames like:

2026-06-08_contract-msa_acme-uk_att1.pdf

Each attachment gets logged to Google Sheets with a dedupe key based on the Gmail message ID and attachment name. When a reviewer needs the document, they search the log, click the Drive link, and pull the file instantly.

Common Variations

1) Route by subject keywords into different Drive folders

Add a router after you generate subject_slug:

  • Invoice/Finance/Invoices
  • MSA/Legal/MSA
  • anything else → /Inbox/Uncategorized

2) After upload, generate a standardized PDF and email it

If the attachment needs processing, chain into document generation. For example, if the attachment is structured data or you have a template-driven output, you can follow the same Make.com document pattern as how we generate PDFs from a Google Docs template using Make.com and Gmail.

3) Post a Slack message for exceptions

If the attachment has no extension, or upload fails, post the email subject and partial metadata into a Slack channel so humans can fix the edge case quickly.

What You Built, and why it stays reliable

You built an intermediate Gmail to Google Drive attachment workflow in Make.com that uses deterministic filenames, idempotency dedupe keys, and a Google Sheets audit log. That combination is what keeps cross-platform attachment handling stable after the first week.

If you want this implemented across your exact inbox rules, Drive structure, and logging requirements, Olmec Dynamics builds these XPAs for real teams. You can see what we do here and start with the Cross-Platform Automation (XPA) overview.