Skip to content
agents/en vrai

Automatically reconcile your bank statement with your open invoices, with approval on Telegram

Drop your bank statement CSV export into Gmail: the agent reads each line, finds the invoice reference (with help from an AI model when needed), matches it to your open invoices in Google Sheets, marks invoices paid or part paid, asks for your approval on Telegram for doubtful cases and can record the payment in Xero or QuickBooks. A monthly digest arrives on Telegram.

L2 semi-autonomousVerified sourceBased on official documentation we checked; not tested by us yet.Updated
Difficulty
Advanced
Setup time
≈ 2 h (estimate)
Estimated cost
Free template. n8n: free self-hosted or from €20/month; OpenAI-compatible AI API billed by usage (optional); Gmail, Google Sheets and Telegram: free; Xero or QuickBooks: paid subscription, only if you record payments there
Category
Small business & freelancers

⏱ Trigger

Whenever a CSV or TSV statement arrives in Gmail under your chosen label (Gmail trigger), plus a scheduled monthly digest

✋ Human approval

Doubtful cases (different amount, amount-only match, several possible invoices) wait for your Approve or Reject click on Telegram. Confident matches settle without you: start in "sheets" mode (Google Sheets register only, nothing sent to Xero or QuickBooks) and test on one real statement before enabling the trigger, as the author recommends.

→ Output

Invoices updated in Google Sheets (paid, part paid), Reconciliation and Unmatched registers, payments recorded in Xero or QuickBooks (optional), Telegram messages and a monthly digest

Autonomy level 2 — Semi-autonomous (approval): Runs on its own but waits for your approval before anything sensitive.

01Connected tools

02What the agent does on its own

  1. step 01

    Starts when an email with your label (for example "Statements") arrives in Gmail and keeps only CSV or TSV attachments.

  2. step 02

    Reads the file whatever its shape: comma, semicolon, tab or pipe separated, decimal commas, dd/mm/yyyy or mm/dd/yyyy dates, one signed amount column or a paid-in/paid-out pair. Rows without a real date and amount are dropped rather than guessed.

  3. step 03

    Pulls invoice references out of the bank narrative with fixed rules, then asks any OpenAI-compatible model (OpenAI, DeepSeek, OpenRouter, Groq) for the references the rules missed. The model is optional: if it fails, the rule-based candidates still stand.

  4. step 04

    Reads the reconciliation register first and drops lines already settled, so re-uploading last month's file cannot settle anything twice. Then reads your open invoices in Google Sheets (paid and cancelled rows are ignored).

  5. step 05

    Scores each line against each open invoice: reference, outstanding balance (total minus amount paid), counterparty and a 45-day date window. Several lines carrying the same reference are added up, so a split payment settles its invoice. Bank fees and internal transfers are recognised and never treated as payments.

  6. step 06

    Confident matches settle on their own. Short, over, amount-only or ambiguous lines go to Telegram with Approve / Reject links and the agent waits for your answer. Lines that match nothing go to an Unmatched register with the reason.

  7. step 07

    For each settlement: updates the invoice row (paid or part paid, amount received, payment reference), adds a register row and, if you chose it, records the payment in Xero or QuickBooks exactly once (idempotency key, three retries, Telegram alert on failure).

  8. step 08

    Every month, reads both registers and sends you a 30-day digest on Telegram: what settled and what is still open.

03Agent instructions

$ instructions.txt · replace the {VARIABLES}
> No instructions to write: AI is only used to spot invoice references in bank narratives. Settings to prepare: {GMAIL_STATEMENTS_LABEL}; an Invoices tab with the columns invoice_key, invoice_number, counterparty, direction, invoice_date, due_date, currency, total, amount_paid, status, external_id; {AI_PROVIDER_AND_MODEL}; {TELEGRAM_CHAT_ID}; TARGET_SYSTEM = {sheets, xero or quickbooks}.

04Limits and legal points

Only CSV or TSV attachments are read: a PDF statement is not processed. If your bank does not email exports, forward the downloaded CSV to yourself with the right label. No currency conversion in the template. The Approve / Reject links use an n8n resume URL: your instance must be reachable from the internet. Xero needs each invoice's ID (external_id column) and the bank account code; QuickBooks needs your vendor and bill IDs. If you use another accounting tool, stay in "sheets" mode and pass the register to your accountant. Bank narratives are sent to the AI provider if you enable it: check what you are willing to share.

05In short

When does the agent run, and what does it produce?
Trigger: Whenever a CSV or TSV statement arrives in Gmail under your chosen label (Gmail trigger), plus a scheduled monthly digest. Output: Invoices updated in Google Sheets (paid, part paid), Reconciliation and Unmatched registers, payments recorded in Xero or QuickBooks (optional), Telegram messages and a monthly digest.
What stays under your control?
Doubtful cases (different amount, amount-only match, several possible invoices) wait for your Approve or Reject click on Telegram. Confident matches settle without you: start in "sheets" mode (Google Sheets register only, nothing sent to Xero or QuickBooks) and test on one real statement before enabling the trigger, as the author recommends. Autonomy level 2 — Semi-autonomous (approval): Runs on its own but waits for your approval before anything sensitive.
How much does it cost and how long does setup take?
Estimated cost: Free template. n8n: free self-hosted or from €20/month; OpenAI-compatible AI API billed by usage (optional); Gmail, Google Sheets and Telegram: free; Xero or QuickBooks: paid subscription, only if you record payments there. Setup time: ≈ 2 h (estimate), difficulty "advanced". Tools: n8n – Gmail Trigger, n8n – Extract From File, n8n – HTTP Request, n8n – Google Sheets, n8n – Telegram, n8n – Wait, Xero – Payments API, QuickBooks Online – Payment API.

Answers taken from this recipe · updated 16 November 2026

06Source

https://n8n.io/workflows/22799-reconcile-bank-statements-with-gmail-openai-google-sheets-xero-and-quickbooks/

07Related recipes

Same category or same connected tools.

All recipes in "Small business & freelancers" →

→ monthly newsletter

3 agents en vrai.
Every month.

Three reproducible, sourced autonomous agents. No hype, no "top 100 tools". One-click unsubscribe.