Track job costs and margins with Gmail, Google Sheets and OpenAI
Quick overview
Description
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 alerts. How it works Triggers when a labeled receipt email arrives in Gmail, a crew member submits the hours form, the daily schedule runs, or you open/submit the receipt review web page. Reads your Jobs and Costs data from Google Sheets to decide what job-related update needs to run for the current trigger. For receipt emails, extracts text from PDF attachments, uses OpenAI vision to transcribe receipt photos, or falls back to the email body, then uses OpenAI to structure key fields like vendor, date, total, category, and job hints. Matches each receipt to an active job from the Jobs sheet, skips duplicates, appends the cost to the Costs sheet, and emails you a secure review link when the receipt is unreadable, ambiguous, or unusually large. For hours submissions, validates the job number against the Jobs sheet, appends the entry to the Hours sheet, and emails you if the job is unknown or the hours look invalid. Every morning, totals costs and labor per active job, compares them to the job estimates, writes rollups back to the Jobs sheet, and emails one-time warnings for new budget, pacing, or margin issues plus a weekly summary on your configured report day. When you open the receipt review link, serves an HTML page to assign the receipt to a job and adjust amount/category, then saves the changes back to the Costs sheet. Setup Connect Gmail and Google Sheets credentials, and add an OpenAI API credential for the receipt parsing and image transcription steps. Run the manual “Create my spreadsheet” trigger once to create the Jobs/Costs/Hours Google Sheet, then paste the returned spreadsheet ID into the workflow settings. Fill in “Your settings” with your owner email address, your n8n base URL (used to generate receipt review links), timezone, and any thresholds like labor rate, warning percentage, and report day. Create a Gmail label (default: job-receipts) and ensure supplier receipts are labeled so the Gmail trigger picks them up and downloads attachments. Replace the example rows in the Jobs sheet with your real job numbers, estimates, and optional aliases (POs, nicknames, addresses) to improve automatic receipt-to-job matching. Share the hours form URL generated by the n8n form trigger with your crew so they can log time against job numbers. An n8n automation workflow template by Michael Matthews.
Community Metrics
Author
Michael Matthews
Platform
web
Pricing model
paid
Categories
- Automation
- AI
Tags
- n8n
- workflow
- google-sheets
- gmail
- code
- openai-chat-model
- openai
- information-extractor
Capabilities
- 6 nodes