Log email receipt data to Google Sheets with Gmail and OpenAI
Ready for 3.0What this workflow does
This AI workflow has 22 nodes and runs on Gmail events (plus 1 other trigger). Along the way it connects Gmail, OpenAI, OpenAI Chat Model and Google Sheets.
How it runs
Trigger: On Gmail events (plus 1 other trigger).
- ⚙️ Your settings (Edit Fields (Set)): sets 4 fields: ownerEmail, sheetUrl, defaultCurrency…
- Receipt or monthly summary? (If): checks a condition and branches into true / false
- Read what is already logged (Google Sheets): uses Google Sheets
- Read the full ledger (Google Sheets): uses Google Sheets
- Keep only the new receipts (Code): runs custom JavaScript code
- Total last month by category (Code): runs custom JavaScript code
- PDF or photo? (Switch): routes items into 2 branches
- Email the monthly summary (Gmail): uses Gmail
- Extract text from PDF (Extract from File): extracts data from a file (pdf)
- Transcribe photo with AI vision (OpenAI): analyze (image)
…plus 8 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
- Still check Gmail Trigger below v1.4 runs as v1.4 (drafts skipped, max emails per poll) (Receipt arrives (Gmail)).
Nodes used (13)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Edit Fields (Set)
n8n-nodes-base.set - If
n8n-nodes-base.if - Switch
n8n-nodes-base.switch - Extract from File
n8n-nodes-base.extractFromFile - OpenAI
@n8n/n8n-nodes-langchain.openAi - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Google Sheets
n8n-nodes-base.googleSheets - Code
n8n-nodes-base.code - Gmail
n8n-nodes-base.gmail
From the author
Quick overview This workflow logs Gmail receipt attachments to Google Sheets by extracting structured fields with OpenAI (including category selection from your list), prevents duplicates by checking the ledger, and sends a monthly spending summary email via…