Auto-file forwarded receipt emails into QuickBooks

By General Input

Every weekday at 6pm, turn forwarded receipt emails into clean QuickBooks expense entries with the right category and the original receipt attached.

Integrations

  • Gmail
  • QuickBooks Online

Type

Agentic Task

Categories

  • Finance
  • Operations

Build an agent workflow that turns forwarded receipt emails in Gmail into clean expense entries in QuickBooks Online. It should run on a cron trigger every weekday at 6pm in my local timezone.

On each run, the agent should:

1. Use Gmail List Messages with a query like `label:receipts is:unread` (make the query configurable so I can change the label or sender filter later) to find new forwarded receipts I haven't processed yet.

2. For each message, call Gmail Get a Message with format=full to read the headers and body, and Gmail Get Attachment for any PDF or image attachment so it has the actual receipt file.

3. Extract the structured fields from the email body and attachment: vendor name, transaction date, total amount, tax amount, currency, payment method hint if present, and a one-line description of what was purchased. Be tolerant of forwarded-email noise ("Begin forwarded message", quoted blocks, signature).

4. Use QuickBooks Query Entities to pull the chart of accounts (Account entity where AccountType = 'Expense') once at the start of the run, plus the list of existing Vendors. Cache both in memory for the rest of the run.

5. For each receipt, reason about the vendor and description to pick the best-fitting expense Account from the chart of accounts. For example: Uber/Lyft → Travel, AWS/Vercel/GitHub → Software/Subscriptions, DoorDash/Grubhub/restaurants → Meals & Entertainment, Staples/Amazon office supplies → Office Supplies. If no expense account is an obvious fit, fall back to a configurable default (e.g. "Ask My Accountant" or "Uncategorized Expense").

6. Match the vendor against existing QuickBooks Vendors by name (case-insensitive, fuzzy). If no match exists, call QuickBooks Create Vendor with the parsed vendor name.

7. Call QuickBooks Create Purchase to record the expense. Use PaymentType = CreditCard by default (make this configurable), set the AccountRef to a configurable payment account (the credit card or bank account the receipt was paid from), and add a single line item with the chosen expense Account, the amount, the tax, the vendor as EntityRef, the transaction date as TxnDate, and the one-line description as the Memo/Description.

8. Use QuickBooks Manage Attachables to upload the original PDF or image and link it to the new Purchase so the source document lives on the transaction in QuickBooks.

9. Once the purchase posts successfully, call Gmail Modify Message Labels to remove the UNREAD label and add a "Filed" label (create it if it doesn't exist) so the same receipt never gets filed twice on the next run.

Handle errors per-message: if any single receipt fails (can't extract a total, QuickBooks rejects the purchase, attachment upload fails), skip it, leave the email unlabeled so it gets retried, and continue with the rest. At the end of the run, print a short summary: how many receipts were filed, total amount posted, and the IDs of any that failed.

Make the following user-configurable inputs at the top of the agent: the Gmail search query, the "filed" label name, the default payment account name in QuickBooks, the fallback expense account name, and the schedule.

Related prompts

Explore more prompts
Win back LiveChat visitors whose chats went unansweredChase the paperwork every new client and vendor still owesFile Gmail attachments into storage with names you can findCandidate rediscovery desk for your archived Lever applicantsLaytime and demurrage claim workspace for chartering opsKajabi customer support console for member access fixesRun your application review round on Jotform submissionsRun your nutrition clients' weekly meal plans from one consoleReplace the dispatch whiteboard with a live production boardJob search command center with a self-filling pipeline board