Quick overview
This workflow polls Gmail every 15 minutes for unread invoice or receipt emails, uses Anthropic Claude (Sonnet) to extract key financial fields, logs new documents to Google Sheets, sends optional Slack alerts for overdue or high-value invoices, and marks processed emails as read.
How it works
- Runs every 15 minutes and triggers on unread emails in Gmail.
- Prepares the email metadata and body text (and any available attachment text) and sets configuration values like the Google Sheets target and Slack threshold.
- Sends the combined email content to Anthropic Claude Sonnet to classify the document and extract structured invoice/receipt fields as JSON.
- Parses the AI response, normalizes amounts and dates, and flags items as overdue or high value based on your threshold.
- Checks Google Sheets for an existing entry with the same invoice number to avoid duplicates.
- Appends new invoice/receipt records to the Google Sheets log and posts a Slack message when an alert condition is met.
- Marks the Gmail email as read after logging (and after any Slack alert) to keep the inbox clean.
Setup
- Connect your Gmail account in both the Gmail trigger and the “Mark as read” action.
- Add an Anthropic (Claude) API credential and ensure the Claude Sonnet model is available in your account.
- Connect your Google Sheets account, set the target spreadsheet ID and sheet name, and create columns that match the fields being appended (for example: Timestamp, From, Subject, Invoice Type, Vendor Name, Invoice Number, Invoice Date, Due Date, Currency, Subtotal, Tax, Total Amount, Payment Status, Line Items, Confidence, Email ID).
- (Optional) Connect your Slack account and set the Slack channel ID, then set the high-value threshold amount used to trigger alerts.
- Review the Gmail polling interval and unread-only filter to match how you want invoices and receipts to be picked up.