Track job costs and margins with Gmail, Google Sheets and OpenAI
Ready for 3.0What this workflow does
This AI workflow has 51 nodes and runs on Gmail events (plus 5 other triggers). Along the way it connects Gmail, Google Sheets, OpenAI and OpenAI Chat Model.
How it runs
Trigger: On Gmail events (plus 5 other triggers).
- Your settings (Edit Fields (Set)): sets or maps fields
- Read settings for the form (Code): runs custom JavaScript code
- Read your settings (Code): runs custom JavaScript code
- Find the job (Google Sheets): uses Google Sheets
- What started this? (Switch): routes items into branches
- Check the hours (Code): runs custom JavaScript code
- Read the jobs (Google Sheets): uses Google Sheets
- Create the spreadsheet (Google Sheets): uses Google Sheets
- Hours row (Edit Fields (Set)): sets or maps fields
- Read the costs (Google Sheets): uses Google Sheets
…plus 34 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)
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 email).
- Code node: the task timeout drops from 300s to 60s. Test with a realistic data volume.
Nodes used (18)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - n8n Form Trigger
n8n-nodes-base.formTrigger - Webhook
n8n-nodes-base.webhook - Schedule Trigger
n8n-nodes-base.scheduleTrigger - Manual Trigger
n8n-nodes-base.manualTrigger - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - Switch
n8n-nodes-base.switch - Google Sheets
n8n-nodes-base.googleSheets - Extract from File
n8n-nodes-base.extractFromFile - OpenAI
@n8n/n8n-nodes-langchain.openAi - Information Extractor
@n8n/n8n-nodes-langchain.informationExtractor - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Filter
n8n-nodes-base.filter - Gmail
n8n-nodes-base.gmail - If
n8n-nodes-base.if - Split Out
n8n-nodes-base.splitOut - Respond to Webhook
n8n-nodes-base.respondToWebhook
From the author
Quick overview This workflow tracks job costs by extracting totals and details from receipt emails in Gmail using OpenAI, logging crew hours via an n8n form, and updating a Google Sheets job-cost spreadsheet with daily budget and margin checks plus email…