Analyze Google Calendar patterns with OpenAI and send Gmail weekly digest
Quick Overview This workflow runs on a weekday schedule or via webhook, pulls events from Google Calendar, analyzes meeting and focus-time patterns, generates optimization advice with OpenAI, then emails a digest through Gmail and appends the results to Google Sheets.
How it works Runs every weekday morning on a schedule or starts on demand from an incoming webhook request. Sets a 7-day lookback and 7-day lookahead window and fetches all matching events from Google Calendar. Normalizes event fields, then excludes all-day, private/OOO, cancelled, and zero-duration events and classifies the remaining events into categories like deep work, collaboration, 1:1s, admin, and external. Aggregates the events and computes metrics such as meeting hours, focus hours, peak meeting hour, heaviest day, back-to-back chains, fragmentation score, top recurring meetings, and largest available free blocks. Sends the computed metrics to OpenAI (GPT-4.1-mini) to generate a concise weekly calendar optimization report. Formats a final report payload with a calculated health score, emails the digest via Gmail, appends the report data to Google Sheets, and returns a JSON success response for webhook runs.
Setup Connect Google Calendar OAuth2 credentials and select the calendar ID to analyze. Connect an OpenAI API key and confirm the model selection (gpt-4.1-mini) fits your account and usage limits. Connect Gmail OAuth2 credentials and replace the recipient address in the email step. Connect Google Sheets OAuth2 credentials, replace YOUR_SHEET_ID (and sheet/tab name if needed) in the Google Sheets append request URL, and ensure the target sheet exists with the expected columns. If using the manual trigger, copy the webhook URL from n8n and call it with a POST request from your preferred tool.
Related Templates
AI Email Classifier & Auto-Delete for Gmail (SPAM/OFFER Cleaner)
This workflow is designed for freelancers, solopreneurs, and business owners who receive a high volume of irrelevant mes...
Generate Food Recipes from Gmail & Form Requests with Ollama & Llama 3.2
This n8n template demonstrates how to create an intelligent food recipe assistant that accepts requests via Gmail and we...
Automatic News Summarization & Email Digest with GPT-4, NewsAPI and Gmail
📰 AI News Digest Agent: Auto News Summarizer & Email Newsletter Create an intelligent news curation system that automat...
🔒 Please log in to import templates to n8n and favorite templates
Workflow Visualization
Loading...
Preparing workflow renderer
Comments (0)
Login to post comments