Quick overview
This workflow imports a bank statement CSV into a Google Sheets envelope budget, auto-allocates transactions using stored rules (and optional OpenAI suggestions), maintains a rolling monthly ledger, and uses Telegram for weekly summaries, overspend alerts, and “learn” commands to create new categorization rules.
How it works
- Triggers when you upload a bank CSV via an n8n form, when the weekly Monday schedule runs, or when a Telegram message is received.
- Loads bank parsing profiles, envelopes, rules, existing transactions, and the monthly ledger from Google Sheets.
- When a CSV is submitted, parses the file using the selected (or auto-detected) bank profile, flags unparseable rows for review, and matches transactions to envelopes using your Rules sheet.
- Optionally sends unknown merchants to OpenAI to suggest an existing envelope and marks items as Allocated or Needs review based on the confidence threshold.
- Deduplicates by transaction ID, upserts new transactions and the recomputed rolling monthly envelope ledger back into Google Sheets, and shows an import summary in the form.
- If any envelopes are newly overspent, sends Telegram alerts and records the alert timestamp in the Monthly sheet to avoid repeat alerts.
- Every Monday, sends a Telegram digest of current-month envelope balances and the review queue, and processes Telegram “/learn MERCHANT => Envelope” commands by saving the rule in Google Sheets and updating matching transactions and the monthly ledger.
Setup
- Create a Google Sheet with tabs named Bank profiles, Envelopes, Rules, Transactions, and Monthly, with columns matching the fields this workflow reads and upserts.
- Add Google Sheets credentials in n8n and set your spreadsheet URL in the configuration values.
- Create a Telegram bot, connect Telegram credentials, and set the allowed Telegram chat ID in the configuration values.
- (Optional) Add OpenAI credentials for the OpenAI chat model and enable AI suggestions by setting useAiForUnknown to true and adjusting minAiConfidence.
- Upload a bank CSV via the form and select the correct bank profile (or Auto-detect) and currency to start importing transactions.