Skip to content

Daily

Archive every email from one sender to a Drive folder

Each new email from the sender you choose is saved as a file in your Drive folder, so you keep a complete record outside your inbox.

Runs
Daily
Apps
Gmail, Google Drive
AI
Not needed
Access
Gmail gmail.readonly; Drive write

Send this to your assistant

Create a ClickRuntime automation: every day, save new emails from billing@northwind.example as files in my Drive 'Archive/Northwind' folder.

Paste it into your assistant. It tells you what it will send or change before it runs live.

First time? Adding ClickRuntime to your assistant takes about two minutes.

Why use it

Why teams use this automation

A property manager deals with one difficult landlord entirely by email. When a dispute comes up, she needs every message in order, and searching her inbox, forwarding threads and printing to PDF takes an evening each time.

Keeping a running copy of every email from one sender in Drive gives you a record that is easy to share with a lawyer, accountant or colleague, and that stays put even if the mailbox changes.

What you get out of it

  • A complete record in one place

    Every email from that sender sits in one folder in date order, ready to share or review.

  • Easy to hand over

    Give an accountant, lawyer or new colleague access to the folder instead of forwarding dozens of threads.

  • Independent of your inbox

    If emails are deleted, archived or the mailbox is closed, the copies in Drive remain.

  • Useful for compliance

    Teams that must keep correspondence with a regulator, client or supplier have a simple, dated archive.

How it works

What happens, step by step

  1. Once a day ClickRuntime looks in your Gmail for new emails from the sender you chose.

  2. It skips any email it has already saved.

  3. Each new email is saved as a file in your Drive folder, named by date and subject.

Before it runs live

  • Connect Google through your own Google app (a one-time, 10-minute setup), so it works with your own Gmail
  • Connect Google Drive

What you get

RunsDaily
Archive every email from one sender to a Drive foldertoday, 9:00Succeeded
Google Drive · Archive/NorthwindSaved 2026-10-18_Your October statement.eml

Build your own

Need it to work differently?

This template is a starting point. Copy the prompt and change it, or describe a different automation from scratch, with your own conditions, more apps or an AI step. Your assistant writes it, tests it and runs it on ClickRuntime.
  • Your own rules

    Conditions, thresholds, filters and exceptions, written the way you'd explain them to a colleague.

  • Any number of apps

    One automation can read from one app and update several others. Over 248 apps are ready, and anything with an API works too.

  • AI where it helps

    Summaries, classification, extraction and drafts use ClickRuntime's built-in AI, with no extra key.

  • On a schedule or on each event

    Runs as often as every 5 minutes, or the moment an app sends an event, and keeps track of what it already handled.

Changes you can ask for

  • Run it at a different time, more or less often, or only on weekdays
  • Add an AI step, for example to summarize, sort or draft a reply
  • Add another app, for example also send it to Slack
  • Combine it with other Gmail and Google Drive steps into one automation

Under the hood

The code that runs this automation

This is the Python script that runs each time the automation starts. Your AI assistant writes it for you when you send the prompt, and you allow each step in your assistant. To change how the automation works, describe the change to your assistant and it updates the script for you. For every function it can use, see the script reference.
export_emails_from_a_sender_to_drive.pyexample
import base64, json
from clickruntime import on_trigger, credentials, http, state

SENDER, FOLDER = "billing@northwind.example", "your-archive-folder-id"
G = "https://gmail.googleapis.com/gmail/v1/users/me"

@on_trigger
def run(event):
    h = {"Authorization": f"Bearer {credentials.connection('google', 'work')}"}
    seen = set(state.get("seen") or [])
    msgs = http.get(f"{G}/messages", headers=h, params={"q": f"from:{SENDER} newer_than:3d"}).json().get("messages", [])
    saved = 0
    for m in msgs:
        if m["id"] in seen:
            continue
        raw = http.get(f"{G}/messages/{m['id']}", headers=h, params={"format": "raw"}).json()
        meta = http.get(f"{G}/messages/{m['id']}", headers=h, params={"format": "metadata", "metadataHeaders": "Subject"}).json()
        subject = next((x["value"] for x in meta["payload"]["headers"] if x["name"] == "Subject"), "no subject")
        name = f"{int(raw['internalDate']) // 1000}_{subject[:60]}.eml"
        http.post("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart", headers=h, files={
            "metadata": (None, json.dumps({"name": name, "parents": [FOLDER]}), "application/json"),
            "file": (name, base64.urlsafe_b64decode(raw["raw"]), "message/rfc822")})
        seen.add(m["id"])
        saved += 1
    state.set("seen", list(seen)[-1000:])
    return {"saved": saved}

FAQ

Common questions

What format are the emails saved in?
As .eml files, which keep the full message with headers and open in any email program. Plain text is also possible if you prefer.
Are attachments included?
Yes. An .eml file contains the original attachments, so nothing is lost.
Can it archive several senders?
Yes. It can take a list of addresses and save each to its own subfolder.
What permissions does it need?
Gmail gmail.readonly; Drive write. Nothing else in your accounts is used.
Does it need AI?
No. It runs without AI, so it doesn't use your plan's AI allowance.
How many runs does it use?
One run each time it runs (daily). Checks that find nothing to do and stop right away aren't counted.
Can I change how it works?
Yes. Describe the change to your AI assistant, for example a different schedule, channel or filter. It updates the automation, tests it and tells you what changed.

Set up “Archive every email from one sender to a Drive folder” from your assistant

Copy the prompt above, or connect your assistant first. Free plan, no credit card.