Quick overview
This workflow lets you upload a Japanese bank deposit CSV, matches credit transfers to open invoices in Google Sheets using kana normalization and rule-based logic, asks Google Gemini for suggestions on remaining deposits, then logs results back to Sheets and posts a reconciliation summary to Slack.
How it works
- Receives a bank deposit CSV upload via an n8n Form and reads it using the configured encoding.
- Parses the CSV to detect date, amount, and payer columns, keeps credit (deposit) rows only, and stops with an error if no deposit rows are found.
- Loads the existing Deposit log from Google Sheets and skips any deposits whose generated deposit ID already exists.
- Loads open invoices from Google Sheets, normalizes payer names (including half-width kana conversion and legal-entity marker stripping), and matches deposits to invoices using reference numbers, exact amounts, fee-deducted amounts, or combinations of invoices.
- Updates matched invoices in Google Sheets as paid and posts a Slack alert if any sheet update fails.
- For unmatched deposits with viable candidates, sends the deposit details and a shortlist of invoices to Google Gemini and keeps only suggestions that meet the configured confidence threshold.
- Appends every processed deposit result to the Deposit log in Google Sheets and posts a single summary message to a Slack channel listing auto-matches, Gemini suggestions to confirm, and unmatched deposits.
Setup
- Create a Google Sheet with an Invoices tab and a Deposit log tab using the columns expected by the workflow (including invoice_id, payer_kana, amount, status, and deposit_id).
- Add Google Sheets credentials, a Google Gemini (Google AI/Gemini) credential for the Gemini chat model, and a Slack credential.
- Update the configuration values in the workflow (Invoices sheet URL, Deposit log sheet URL, Slack channel ID, CSV encoding, fee limit, open status values, and the minimum Gemini confidence threshold).
- Export your bank deposit statement as a CSV (Shift_JIS or UTF-8) and upload it through the form trigger URL.