See llms.txt for all machine-readable content.

Back to Templates

Log Gmail invoice and receipt attachments in Google Sheets

Quick overview

This workflow polls Gmail for unread invoice or receipt emails, extracts text from PDF/CSV/Excel attachments (or uses the email body), parses key billing fields, and logs new entries to a Google Sheets “Invoices” tab, creating a Gmail draft for anything that needs manual review.

How it works

  1. Runs every hour and searches Gmail for unread messages matching the invoice/receipt query, downloading any attachments.
  2. Splits each email into one item per attachment, or falls back to using the email body text when there are no attachments.
  3. Extracts content from PDF, CSV, and Excel attachments into text or rows so it can be parsed.
  4. Parses the content to identify vendor, invoice/receipt number, invoice date, currency, subtotal, tax, and total, and assigns a confidence/status.
  5. If the item is ready to log, looks up the invoice_number in Google Sheets to prevent duplicates.
  6. Appends a new row to the Google Sheets “Invoices” tab when it is not already logged, otherwise skips it.
  7. Creates a Gmail draft addressed to you for low-confidence or unreadable items so you can review and enter them manually.

Setup

  1. Connect Gmail OAuth2 credentials for both the Gmail Trigger and the Gmail draft creation step.
  2. Connect Google Sheets OAuth2 credentials and create a spreadsheet with a sheet/tab named “Invoices” and the expected columns (including invoice_number).
  3. Paste your Google Sheets URL, set the sheet name, owner email, and default currency in the workflow’s configuration values.
  4. Review and adjust the Gmail search query to match your labeling and filtering preferences before activating the workflow.