Quick Overview
This workflow processes expense receipts emailed to Gmail, extracts receipt data with OpenAI, checks it against rules and historical data stored in Google Sheets, and routes claims for manager/finance approval, then runs a weekly payout with missing-receipt chasers and payment tracking.
How it works
- Triggers when new emails arrive in a dedicated Gmail inbox and downloads any attachments.
- Loads Employees, Policy, prior Claims, and Card transactions from Google Sheets to use as reference data for validation and matching.
- Splits each email into individual receipt items (image, PDF, or forwarded email text) and uses OpenAI to extract structured receipt fields, then normalizes dates and amounts.
- Fetches historical exchange rates from the Frankfurter (ECB) API and checks each receipt for age, currency conversion, company card matches, duplicates, and policy limits to decide reimbursable amounts and whether approval is required.
- Emails the appropriate approver (employee’s manager or finance) via Gmail with an approve/decline action when needed, otherwise auto-approves within-policy claims.
- Writes one row per receipt line to the Claims tab in Google Sheets with the decision details, then emails the employee a line-by-line outcome summary.
- Every Friday, reads approved unpaid claims and employee banking details from Google Sheets, emails chasers for unmatched company card spend, and sends finance a single Gmail approval to release the payout.
- If finance approves, marks the related claim lines as paid in Google Sheets and emails each employee a remittance advice, and if the workflow run fails it alerts finance by Gmail.
Setup
- Add Gmail credentials for the receipts mailbox and for sending approval, outcome, chaser, payout, and failure-alert emails.
- Add Google Sheets credentials and create one spreadsheet with tabs named Employees, Policy, Claims, and Card transactions.
- Add an OpenAI API credential (used by the OpenAI vision/chat model for receipt extraction).
- Update the spreadsheet ID and finance email address in both Set nodes (Set Expense Policy and Set Payout Settings), and set the expenses mailbox address in Set Payout Settings.
- Populate the Employees, Policy, and Card transactions tabs with the required columns (including employee email/manager email, policy category limits, and card transaction IDs/amounts/card last4) so matching and approvals work correctly.