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.
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
Once a day ClickRuntime looks in your Gmail for new emails from the sender you chose.
It skips any email it has already saved.
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
Build your own
Need it to work differently?
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
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?
Are attachments included?
Can it archive several senders?
What permissions does it need?
Does it need AI?
How many runs does it use?
Can I change how it works?
Related
You might also like
Get a weekly email of Drive files shared too widely
Every Monday you get an email listing recently edited Drive files that anyone with the link or people outside your company can open.
See how it worksGet emailed when a web page changes, with snapshots in Drive
Whenever a page you watch changes, you get an email showing what changed and a copy of the new version is saved to Drive.
See how it worksSave client email attachments into Drive, one folder per company
Attachments from client emails are filed in Drive automatically, each in a folder named after the sender's company.
See how it worksKeep exploring
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.