Josh Ramirez
← Field guide

Entry 13 of 23

Departed Spring 2025

Gmail and CalendarAutomationShipped
Gmail reminder email from Tim Woodward beside a Google Calendar event popup titled Retake Women and Minority Group Key Terms Quiz, scheduled Friday May 2 from 8:00 to 9:00am, with the calendar week visible behind it
The moment it worked: an email reminder became a calendar block before I added it myself.

Departure

My calendar was only as good as the number of emails I remembered to translate into events. School sends deadlines, retakes, meetings, reminders, and schedule changes through Gmail first, and I was the unreliable middleware between inbox and calendar. Email2Calendar was the replacement: watch Gmail every 15 minutes, decide whether an email contains a real future event, extract the details with Gemini, and create the Google Calendar event before I forget.

Approach

5 tools

  • Google Apps Script
  • Gmail API
  • Google Calendar API
  • Gemini 2.0 Flash
  • Structured JSON output

Runs inside Apps Script quotas: 6 minutes per execution and 90 minutes total runtime per day. It has to be selective, idempotent, and fast enough to run on a 15-minute timer.

Field log

8 entries

  1. Spring 2025 — the shape

    The whole product fit in three verbs: watch email as context, decide whether something is calendar-worthy, then add the event. Gmail held the source of truth; Google Calendar held the future. The missing piece was judgment.

    Side-by-side presentation graphic with the Google Apps Script logo on the left and Gemini 2.0 Flash Thinking Experimental wordmark on the right
    Apps Script for Google account access, Gemini for event judgment.
  2. The loop

    Every 15 minutes, Apps Script wakes up, checks recent Gmail threads, filters out anything already labeled CalendarApp_Processed, looks for the first unread message, asks Gemini whether it contains a concrete future event, and then writes to Calendar if the answer is yes. After success, it marks the message read and labels the thread so the same email does not become the same event twice.

    Logic diagram showing Every 15 minutes from the Gmail logo to Filter Unread Emails, then Extract Events via Gemini 2.0 Flash, then Create Calendar Events with the Google Calendar logo, looping back after waiting 15 minutes
    A tiny cron job with one job: inbox to calendar.
  3. Why Apps Script

    Google Apps Script is not glamorous, but it is already inside the Google account boundary. It can read Gmail, write Calendar events, create labels, and install a timer trigger without standing up a server. For this task, boring was the point.

  4. The Gemini contract

    The model response was forced into a schema: add_event boolean, then event_details only when needed. Event details carried title, startTime, endTime, isAllDay, location, description, guests, and an eventTypeSuggestion for rough categorization. If the email was a newsletter, vague opportunity, past event, system notice, or simple confirmation, Gemini had to return add_event false.

  5. Time was the hard part

    The prompt included the current timestamp, the sender, subject, and trimmed email body, then told Gemini to resolve relative dates from that moment. Unless the email said otherwise, everything was treated as America/Chicago and converted to UTC before output. School shorthand got rules too: 'during flex' meant 2:35 to 3:00 PM.

  6. Quota math

    Apps Script gives 6 minutes per execution and 90 minutes per day. A no-email run lasted about two seconds. At 96 runs a day, the idle loop used roughly 3.2 minutes total. Runs with a few candidate emails took closer to 15 seconds depending on Gemini, still comfortably inside the free limits.

  7. The proof

    I was adding items to my calendar when I remembered I needed to retake an APUSH quiz. When I went to block Friday morning, the event was already there. Mr. Woodward had sent a reminder email, and Email2Calendar had quietly caught it.

    Gmail message about retaking the women and minority group key terms quiz, with smart reply buttons, next to a Google Calendar event created for Friday May 2 from 8:00 to 9:00am
    The reminder email became a real calendar event.
  8. Next pass

    The obvious extensions were Schoology integration and sharper prompting. Gmail catches the messages adults send. Schoology catches the assignments systems publish. The useful version eventually needs both.

From the gallery

3 figures

Email2Calendar logic loop from Gmail through unread filtering, Gemini extraction, and Google Calendar creation
Every 15 minutes: read, filter, extract, create.
Final Email2Calendar result showing a Gmail reminder and the generated Google Calendar event
A reminder email turned into a Friday morning quiz retake block.
Google Apps Script and Gemini 2.0 Flash logos used as the Email2Calendar tech stack graphic
The two-piece stack.

What I came back with

96 checks/day for about 3.2 idle runtime minutes

Private Gmail-to-Calendar Apps Script

Lesson from the terrain

The useful part of the LLM was not writing prose; it was making a bounded decision inside a strict contract. Does this email deserve calendar space, and if so, what exact times should exist? Apps Script handled the plumbing, labels handled duplicates, and Gemini handled the judgment. The fragile part is that judgment has to be conservative: a missed event is annoying, but a calendar full of false positives is worse because it trains me to stop trusting the calendar.

Cross-links