Every 15 minutes
Save email attachments to Drive and add mentioned dates to your calendar
Attachments from school or client emails are saved to Drive, and any dates they mention appear in your Google Calendar.
- Runs
- Every 15 minutes
- Apps
- Google Calendar, Google Drive
- AI
- Yes, uses the built-in AI allowance
- Access
- drive.file; calendar.events
Send this to your assistant
Create a ClickRuntime automation: when school or client emails arrive, save the attachments to Drive and add any event dates they mention to my Google Calendar.
First time? Adding ClickRuntime to your assistant takes about two minutes.
Why use it
Why teams use this automation
A parent of three gets a steady stream of school emails: newsletters with term dates, permission slips, a trip letter with a deadline buried in the third paragraph. Attachments get lost in the inbox and dates are missed until a child mentions them the night before.
Filing every attachment and pulling the dates into the family calendar means letters are easy to find and nothing sneaks up. The same works for a freelancer whose clients email briefs with deadlines inside.
What you get out of it
Dates you would have missed
Deadlines and events hidden in long emails are picked out and put where you plan your week.
Attachments in one place
Letters, forms and briefs are saved to Drive, so you can find them without searching your inbox.
Less reading in a hurry
You no longer need to read every newsletter closely on the day it arrives just to catch a date.
A shared view for the household or team
A shared calendar and folder let everyone see the same dates and documents.
How it works
What happens, step by step
Every few minutes, ClickRuntime checks your Gmail for new emails from the senders you chose.
Each attachment is saved to your chosen Google Drive folder.
AI reads the email and picks out any events with clear dates.
Those events are added to your Google Calendar, and the email is marked so it is not handled again.
Before it runs live
- Connect Google Calendar
- 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
- Act only on the items that match your own rules, and skip the rest
- Change what the AI looks for, or how it writes the result
- Add another app, for example also send it to Slack
- Combine it with other Google Calendar and Google Drive steps into one automation
Under the hood
The code that runs this automation
import base64
from googleapiclient.http import MediaInMemoryUpload
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from clickruntime import on_trigger, credentials, ai, report_fetched
FOLDER_ID, DONE_LABEL = "your-drive-folder-id", "Label_filed"
@on_trigger
def run(event):
creds = Credentials(credentials.connection("google", "work"))
gmail = build("gmail", "v1", credentials=creds, cache_discovery=False)
msgs = gmail.users().messages().list(userId="me", q="label:School -label:filed").execute().get("messages", [])
report_fetched(len(msgs))
if not msgs:
return {"handled": 0}
drive, cal = build("drive", "v3", credentials=creds, cache_discovery=False), build("calendar", "v3", credentials=creds, cache_discovery=False)
schema = {"type": "object", "properties": {"events": {"type": "array", "items": {"type": "object",
"properties": {"title": {"type": "string"}, "date": {"type": "string"}}}}}}
for m in msgs:
msg = gmail.users().messages().get(userId="me", id=m["id"]).execute()
for part in msg["payload"].get("parts", []):
if part.get("filename") and part["body"].get("attachmentId"):
data = gmail.users().messages().attachments().get(userId="me", messageId=m["id"], id=part["body"]["attachmentId"]).execute()
drive.files().create(body={"name": part["filename"], "parents": [FOLDER_ID]},
media_body=MediaInMemoryUpload(base64.urlsafe_b64decode(data["data"]), mimetype=part["mimeType"])).execute()
found = ai.generate(f"List events with a clear date (YYYY-MM-DD) in this email:\n{msg['snippet']}", json_schema=schema).json["events"]
for e in found:
cal.events().insert(calendarId="primary", body={"summary": e["title"], "start": {"date": e["date"]}, "end": {"date": e["date"]}}).execute()
gmail.users().messages().modify(userId="me", id=m["id"], body={"addLabelIds": [DONE_LABEL]}).execute()
return {"handled": len(msgs)}FAQ
Common questions
Which emails does it look at?
What if a date is unclear?
Will the same email be processed twice?
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
Turn meeting transcripts into action items and follow-ups
When a meeting transcript lands in Drive, the action items are pulled out for you and any follow-up meetings are put in your calendar.
See how it worksLet your voice or chat agent book appointments and answer from Drive
Your AI phone or chat agent can check your free times, book appointments in Google Calendar and answer questions from your FAQ document in Drive.
See how it worksPrepare a lesson plan for each of tomorrow's classes
Each evening, every class in tomorrow's calendar gets a lesson plan document in Drive, linked from the calendar event.
See how it worksKeep exploring
Set up “Save email attachments to Drive and add mentioned dates to your calendar” from your assistant
Copy the prompt above, or connect your assistant first. Free plan, no credit card.