Extract and log email orders with Gmail, GPT-4o-mini, and Google Drive/Sheets
Ready for 3.0What this workflow does
This AI workflow has 40 nodes and runs on Gmail events (plus 1 other trigger). Along the way it connects Gmail, OpenAI, Google Drive and Google Sheets. It also calls api.openai.com over HTTP.
How it runs
Trigger: On Gmail events (plus 1 other trigger).
- Route by Email MIME Type (Switch): routes items into 2 branches
- Is iPaper Order Subject? (If): checks a condition and branches into true / false
- Limit: keeps the first few items
- Extract Email Body Fields (Edit Fields (Set)): sets 1 field: text
- Get Full Email Message (Gmail): get
- Loop Over Orders (Loop Over Items (Split in Batches)): loops over the items in batches
- Loop Over Emails (Loop Over Items (Split in Batches)): loops over the items in batches
- Parse iPaper Order Email Text (Code): runs custom JavaScript code
- Create Vector Store (HTTP Request): calls api.openai.com (POST)
- Split iPaper Order Items (Split Out): splits a list into separate items
…plus 28 more steps. See the full node list below.
Services it uses
Other Google Sheets + Gmail templates (2,102) · Other OpenAI + Google Sheets templates (2,011) · Other OpenAI + Gmail templates (1,623)
HTTP calls to: api.openai.com
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) (Gmail Trigger, Gmail Trigger - iPaper Order Emails).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (16)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Switch
n8n-nodes-base.switch - Limit
n8n-nodes-base.limit - Gmail
n8n-nodes-base.gmail - HTTP Request
n8n-nodes-base.httpRequest - Code
n8n-nodes-base.code - OpenAI
@n8n/n8n-nodes-langchain.openAi - Aggregate
n8n-nodes-base.aggregate - Split Out
n8n-nodes-base.splitOut - Wait
n8n-nodes-base.wait - If
n8n-nodes-base.if - Convert to File
n8n-nodes-base.convertToFile - Google Drive
n8n-nodes-base.googleDrive - Google Sheets
n8n-nodes-base.googleSheets - Loop Over Items (Split in Batches)
n8n-nodes-base.splitInBatches - Edit Fields (Set)
n8n-nodes-base.set
From the author
Quick overview This workflow watches Gmail for incoming order emails, extracts structured order and line-item data using OpenAI (vector stores and GPT-4o-mini), then exports the results as CSV files to Google Drive and logs each order to Google Sheets. How it…