Skip to content

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.

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 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

  1. Every few minutes, ClickRuntime checks your Gmail for new emails from the senders you chose.

  2. Each attachment is saved to your chosen Google Drive folder.

  3. AI reads the email and picks out any events with clear dates.

  4. 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

RunsEvery 15 minutes
Save email attachments to Drive and add mentioned dates to your calendartoday, 9:00Succeeded
Google Calendar · FamilyYear 5 trip to the Acme Science Museum, Friday 7 November (slip saved to Drive/School)

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

  • 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

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.
file_and_schedule_from_incoming_emails_or_cards.pyexample
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?
Emails from the senders or with the label you choose, such as your children's school or a few clients. Other mail is ignored.
What if a date is unclear?
Events are only added when the email gives a clear date. Vague phrases such as later this term are left out rather than guessed.
Will the same email be processed twice?
No. Each email is marked once handled, so its attachments and dates are added only once.
What permissions does it need?
drive.file; calendar.events. Nothing else in your accounts is used.
Does it need AI?
Yes. It uses ClickRuntime's built-in AI, so you don't need an OpenAI or Anthropic key. Every plan includes a monthly AI allowance.
How many runs does it use?
One run each time it checks. Checks that find nothing new 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 “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.