Automate Gmail with GPT-4o: Classify & Log Emails to Sheets
Automate Gmail with GPT-4o: Classify & Log Emails to Sheets
Couldn't load pickup availability
Automate Gmail with GPT-4o: Classify & Log Emails to Sheets
Transform your Gmail inbox into an intelligent email management system with this powerful n8n workflow that automatically classifies incoming emails using OpenAI's GPT-4o and creates AI-drafted replies for urgent messages—all while maintaining a comprehensive tracking log in Google Sheets.
What this workflow does
This automation monitors your Gmail inbox every minute and intelligently processes new emails through a sophisticated triage system. When an email arrives, the workflow extracts key details including sender, subject, body text, message ID, and thread ID. OpenAI's GPT-4o model then analyzes the content to classify each message as either URGENT or NOT_URGENT based on context and content.
For emails classified as urgent, the workflow goes a step further—GPT-4o generates a concise, contextually appropriate reply and automatically saves it as a Gmail draft within the original email thread. Every processed email is logged to your designated Google Sheets spreadsheet with timestamp, sender information, subject line, urgency classification, and draft creation status for complete visibility and tracking.
Use cases
- Customer support automation: Instantly identify and prioritize urgent customer issues while preparing draft responses
- Business email management: Automatically triage client communications and vendor correspondence
- Executive assistance: Filter important emails requiring immediate attention from routine communications
- Project management: Track email volume and response patterns across different projects or clients
Technical details
This n8n workflow utilizes Gmail Trigger and Gmail nodes for email monitoring and draft creation, OpenAI integration for GPT-4o classification and reply generation, Google Sheets node for logging, plus Set and If nodes for data processing and conditional logic. Sticky Note nodes provide workflow documentation.
Setup requires Gmail OAuth2 credentials, OpenAI API access with GPT-4o model permissions, and Google Sheets OAuth2 connection. The workflow is fully customizable—adjust Gmail trigger filters to process specific labels like "Clients" or "Support" instead of monitoring the entire inbox.
