Quick overview
This workflow watches a Google Drive folder for new bank-statement PDFs or CSVs, extracts transactions with OpenAI, reconciles opening/closing balances, and appends only new (non-duplicate) transactions to Google Sheets with rule-based categorization, while logging every import and emailing you when a statement fails reconciliation.
How it works
- Triggers when a new file is created in a specified Google Drive folder.
- Downloads the statement and extracts text from the file (PDF text extraction or CSV-to-text).
- Sends the extracted text to OpenAI to return structured JSON containing account details, statement period, balances, and a transaction list.
- Validates that opening balance plus all transaction amounts equals the closing balance (in integer cents) and optionally identifies the first running-balance mismatch.
- If the statement does not reconcile, logs the refused import to Google Sheets and sends a Gmail email explaining the discrepancy and any suspected sign error.
- If the statement reconciles, reads category rules and existing transaction fingerprints from Google Sheets, categorizes transactions, and keeps only transactions not previously imported.
- Appends the new transactions to the Google Sheets Transactions tab and writes a summary entry to the Import log tab.
Setup
- Connect Google Drive credentials, choose the folder to watch, and ensure n8n has permission to download files from it.
- Connect an OpenAI credential (Chat Model) and select the model used to extract statement data.
- Connect Google Sheets credentials and set the spreadsheet and sheet names for Transactions, Rules, and Import log in all Google Sheets nodes.
- Prepare your Google Sheet tabs/columns, including a Transactions column named Fingerprint and a Rules tab with Match, Category, and Direction (in/out/any).
- Connect Gmail credentials, replace the recipient address in the email action, and confirm your Gmail account can send messages from n8n.
Requirements
- n8n (self-hosted or Cloud); built and tested on n8n 2.x
- A Google Drive folder for statements (PDF or CSV) and one Google Sheet with Transactions, Rules and Import log tabs
- An OpenAI API key, or any OpenAI-compatible provider
- Gmail for the alert when a statement doesn't reconcile
Customization
- Stricter checks: add your own rules to the balance check, such as refusing statements that overlap a closed month
- Other sources: replace the Drive trigger with a Gmail trigger on your bank's statement emails
- Accounting tools: swap the Sheets append for QuickBooks, Xero or a database; the fingerprint keeps re-imports safe there too
Additional info
What you get: one importable workflow file (JSON, 17 nodes) with setup notes pinned beside every step, delivered as an instant download after checkout. Use it in unlimited workflows of your own or your clients'. Payments are handled by Paddle (merchant of record). 14-day full refund, no questions asked. Questions before or after buying: [email protected]. This is a data-import tool, not accounting or financial advice.