Reconcile bank statements with Gmail, OpenAI, Google Sheets, Xero and QuickBooks
Quick overview
Description
Quick overview Reconciles a bank statement export against your open invoices: references extracted in two passes, split and partial payments understood, anything uncertain approved in Telegram, and settled payments posted to Xero or QuickBooks exactly once. How it works A Gmail trigger keeps CSV and TSV statement attachments. Extract From File turns the file into text, then the parse node reads it whatever shape it arrives in: 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. A normalise node pulls the reference tokens out of the narrative and builds one statement key per line; a second pass asks any OpenAI-compatible model for the references the pattern pass cannot see. The model is optional: a dead or babbling model leaves the deterministic candidates standing. The reconciliation register is read first and statement keys that already settled are dropped, so re-uploading last month's file cannot settle anything twice. The open invoice sheet is read next, with paid and cancelled rows ignored. Every line is scored against the open invoices on reference, outstanding balance (total minus amount_paid), counterparty and a 45-day date window. Two or more lines carrying the same reference are added up before they are judged, so a split payment settles the invoice it belongs to. A three-way switch routes the result: confident lines settle themselves, short, over, amount-only or ambiguous lines go to Telegram with Approve and Reject links and the run waits for the answer, and lines that match nothing are written to the unmatched register with the reason. Bank fees and internal transfers are recognised and never treated as payments. Settlement writes the invoice row (status paid or part paid, amount received, payment reference) and a reconciliation register row, then routes the payment to Xero or QuickBooks with an idempotency key, three retries and a Telegram escalation when posting fails. A monthly schedule reports what settled and what is still open. Sends uncertain matches to Telegram for approve/reject via a resume URL, recording approved items as reconciled or logging rejected/unmatched items to an Unmatched sheet and notifying Telegram. Runs monthly on a schedule to read the Reconciliation and Unmatched sheets, builds a 30-day digest, and sends the summary to Telegram. Setup Connect Gmail (OAuth2) and create a label such as Statements with a filter for your bank's exports. Connect Google Sheets and create three tabs: Invoices (invoice_key, invoice_number, counterparty, direction, invoice_date, due_date, currency, total, amount_paid, status, external_id), Reconciliation and Unmatched - leave the two registers empty, the workflow writes its own headers on the first run. Create an HTTP Header Auth credential for any OpenAI-compatible provider (OpenAI, DeepSeek, OpenRouter, Groq) and set the model name in the request body. Connect a Telegram bot credential and put your chat ID on the four message nodes. Set TARGET_SYSTEM in the match node to xero, quickbooks or sheets. For an accounting system replace the placeholder URL and connect the OAuth2 credential: Xero needs the bill or invoice ID, mapped from the sheet's external_id column, plus a bank account code; QuickBooks needs your vendor and bill ids from the company file. Test on one real statement export before enabling the trigger: check the Invoices status column, the Reconciliation rows and the unmatched register. Then leave the monthly digest schedule as it is, or move it. If posting payments, connect Xero OAuth2 or QuickBooks OAuth2 credentials and replace placeholder values such as Xero bank account code, QuickBooks realm/vendor IDs, and invoice external IDs (or set the target system to sheets for ledger-only mode). Requirements A Gmail account with a labelled statement feed, a Google Sheet holding your open invoices (with an external_id column if you post to Xero or QuickBooks), an OpenAI-compatible API key and a Telegram bot. Xero or QuickBooks OAuth2 credentials are only needed to post payments into an accounting system. Customization Point the two reads at Airtable or a database instead of Sheets, add currency conversion before scoring, make the approval threshold per counterparty, add a second approver above a ceiling, or send the registers to Slack or email instead of Telegram. An n8n automation workflow template by Shuo Yuan.
Community Metrics
Author
Shuo Yuan
Platform
web
Pricing model
paid
Categories
- Automation
Tags
- n8n
- workflow
- google-sheets
- http-request
- telegram
- code
Capabilities
- 4 nodes