ChatGPTCreativeWritingAI score · 83/100AI-assisted edit · no obvious prompt-injection riskn8n.io

Auto-build interactive bank expense reports with n8n + OpenAI

Upload CSV or text PDF → parse transactions → AI-categorize merchants → generate HTML report with charts, monthly breakdowns, and recurring-charge detection

Some experienceStepsWorkflowPromptTip
Who
Individuals or small teams with an n8n instance who need automated bank statement analysis
You get
An interactive web report with category bars, monthly tables, annualized recurring costs, AI commentary, and CSV download
You need
n8n

Constraints

Prerequisites: accessible n8n instance (self-hosted or cloud), OpenAI API key. Input is a bank-exported CSV or text-based PDF (scanned/image PDFs not supported). Cost depends on OpenAI API usage (this template uses gpt-4o-mini).

What they did

incrementors published an n8n official template that lets users upload a bank statement (CSV or text PDF) via a form, automatically parses transactions, uses an OpenAI model to categorize merchants, computes summaries, and generates an interactive HTML report with charts, recurring-charge detection, and AI-written commentary. The template contains 19 nodes and uses gpt-4o-mini, supporting multiple international bank formats.

How it went

The author reports the template automatically handles US, UK, Indian, and European statement formats without manual delimiter or date configuration (author_report). Output includes category bars, monthly income/spend tables, annualized recurring costs, largest transactions, AI-generated narrative summary with observations and questions to check, plus a downloadable CSV.

Worth knowing

Scanned or image PDFs cannot be extracted—use bank-exported CSV instead (explicit source limitation). AI categorization is inferred from merchant names and may be wrong; the report footer states this explicitly. Both AI Agents share one OpenAI Chat Model node, swappable for Anthropic, Gemini, Groq, or Ollama. Recurring charge detection is computed by code node based on amount stability and date similarity, not model guesswork. Annualized cost = typical charge × 12, not a figure from the statement. This site has not tested the workflow; reproduction=not_tested.

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • After import, connect your own credentials on auth-required nodes; author secrets are not included.

Configuration to replace

  • Source template is n8n public workflow #17753 (~19 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-24

Steps

  1. Configure trigger and upload form

    After importing the workflow into n8n, locate the 'Upload Statement' form trigger node. It is pre-configured to accept .csv, .txt, .pdf files. No modification is required, but you may adjust the form title or description. Activate the workflow, then copy the production URL from this node for later uploads.

  2. Detect file type and extract text

    The workflow uses the 'Is it a PDF?' IF node to check the uploaded file's MIME type. If PDF, it routes to 'Extract PDF Text'; otherwise to 'Extract CSV Text'. Both branches merge at the 'Combine File Branches' node, outputting a single raw text string.

  3. Parse transactions

    The 'Parse Transactions' code node auto-detects delimiters (comma/semicolon/tab/pipe), date format (DD/MM or MM/DD), and column layout, outputting a normalized transaction list and deduplicated merchant list. Supports US, UK, Indian, and European formats. Throws explicit errors if no transactions can be read.

  4. AI-categorize merchants

    The 'Build Category Prompt' code node constructs a prompt sending the deduplicated merchant list to the OpenAI model. The model assigns each merchant a fixed category (e.g., Housing, Groceries, Subscriptions) and a readable name. The 'Categorize Payees' AI Agent node then executes this, instructing the model to return pure JSON only, never invent merchants, and never perform arithmetic.

    Execution prompt · Source text。Categorize Payees node systemMessage field

    You categorise bank statement payees. You are given messy abbreviated merchant strings and you assign each one a category from a fixed list, plus a readable name.
    
    You never perform arithmetic, never invent merchants, and never return a merchant that was not in the input list.
    
    You always respond with a single valid JSON object and nothing else. No markdown code fences, no preamble, no explanation.

    Execution prompt · Editorial suggestion。Build Category Prompt node jsCode-constructed user prompt; {{merchant_list}} is runtime variable

    Below is a list of merchant names taken from a bank statement. Assign each one a spending category.
    
    Allowed categories, use these exact strings:
    Housing, Groceries, Dining & Takeaway, Transport, Fuel, Utilities, Phone & Internet, Subscriptions, Shopping, Health & Medical, Insurance, Education, Entertainment, Travel, Fees & Charges, Cash Withdrawal, Transfers, Income, Business Expense, Other
    
    Guidance:
    - Income is only for money coming in such as salary, client payment, refund, interest.
    - Subscriptions means recurring digital or membership services such as streaming, software, gym.
    - Transfers means moving money between own accounts, or person to person transfers with no clear purpose.
    - Fees & Charges means bank fees, interest charged, penalties, late fees.
    - Use Other only when the name genuinely gives no clue. Do not overuse it.
    - The merchant names are messy and abbreviated. Infer from partial names where a reasonable person could.
    
    Merchants:
    {{merchant_list}}
    
    Return strictly this JSON object and nothing else:
    {
      "categories": [
        { "merchant": "the exact merchant string given above", "category": "one of the allowed categories", "clean_name": "a readable brand or payee name, title case, or the merchant string cleaned up if unknown" }
      ]
    }
    
    Rules:
    - Return one entry for every merchant listed, using the exact merchant string as given.
    - Never invent merchants that were not listed.
    - Do not use em dashes anywhere in the output.
    - No markdown code fences, no explanation before or after the JSON.
  5. Calculate summary data

    The 'Calculate Totals' code node computes: spend/income totals, category percentages, monthly breakdowns, largest single transactions, recurring charge detection (based on merchant, amount stability, and similar charge dates), and annualized costs. Uncategorized transactions default to Other or Income.

  6. Generate AI commentary

    The 'Build Insights Prompt' code node formats the computed summary into a prompt for the 'Insights Agent' AI Agent node. The model generates a plain-language summary, observations (tagged Watch/Notable/Positive), a recurring-charge note, and questions to verify. The model is instructed not to give investment advice, not to invent numbers, and not to assume trends.

    Execution prompt · Source text。Insights Agent node systemMessage field

    You read a pre-calculated bank statement summary and describe what it shows, in plain language.
    
    Every figure you are given was computed arithmetically. You treat those figures as exact, quote them as given, and never recalculate or contradict them. You never invent a number, merchant or trend that is not in the data.
    
    You describe what the data shows. You do not give investment advice, do not recommend financial products, and do not tell the person what they should or should not buy.
    
    You always respond with a single valid JSON object and nothing else. No markdown code fences, no preamble, no explanation.

    Execution prompt · Editorial suggestion。Build Insights Prompt node jsCode-constructed user prompt; {{variables}} are runtime substitutions

    Here is a summary of one bank statement. Every figure below was calculated arithmetically from the statement, so treat all numbers as exact and never recalculate or contradict them.
    
    Period: {{period_start}} to {{period_end}} ({{month_count}} month(s), {{transaction_count}} transactions)
    Total spent: {{spend_total}}
    Total received: {{income_total}}
    Net: {{net_total}}
    Average monthly spend: {{avg_monthly_spend}}
    
    ## Spend by category
    {{category_lines}}
    
    ## Month by month
    {{month_lines}}
    
    ## Repeating charges detected (same payee, near identical amount, similar day each month)
    {{recurring_lines}}
    
    ## Repeating charges that stopped before the final month
    {{dormant_lines}}
    
    ## Largest single transactions
    {{biggest_lines}}
    
    Write a short, useful read of this statement. Return strictly this JSON object:
    {
      "summary": "3 to 4 sentences describing where the money actually went this period, in plain language, quoting the real figures",
      "observations": [ { "title": "short headline", "detail": "2 to 3 sentences citing the exact figures from above", "tag": "Watch|Notable|Positive" } ],
      "subscription_note": "2 to 3 sentences about the repeating charges, including the total annualised cost, and specifically calling out any that stopped mid period since those may be forgotten or cancelled. If none were detected, say so plainly.",
      "questions_to_check": [ "a specific thing the account holder should verify on their own statement, phrased as a question" ]
    }
    
    Rules:
    - Give 4 to 6 observations and 3 to 5 questions_to_check.
    - Only use the figures given above. Never invent a number, a merchant, or a trend you cannot see in this data.
    - If the period is a single month, do not describe trends over time.
    - Describe what the data shows. Do not give investment advice, do not recommend financial products, and do not tell the person what they should or should not buy.
    - Categories were assigned automatically from payee names and can be wrong, so do not treat any single categorisation as certain.
    - Do not use em dashes anywhere in the output.
    - No markdown code fences, no explanation before or after the JSON.
  7. Build and serve HTML report

    The 'Build Report Page' code node assembles an interactive HTML page: summary tiles, category bars, monthly table (when multi-month), recurring charges table (with 'stopped' badges), largest transactions table, AI commentary section, full transaction filterable table, and CSV download link. The 'Show Report' form node returns this HTML directly as the response.

Prompt you can copy

Setup guidance · Editorial suggestion。Hand to setup assistant to help user import template, configure credentials, and test

This block is the prompt. Ads are never placed here.

You are an n8n workflow setup assistant. The user wants to replicate the 'Bank Statement to Expense Breakdown' template. Assist in this order:
1. Confirm the user has an n8n instance (self-hosted or cloud) and an OpenAI API key;
2. Guide them to import the workflow JSON from https://n8n.io/workflows/17753/;
3. Configure the API credential in the 'OpenAI Chat Model' node, ensuring both AI Agent nodes connect to it;
4. Activate the workflow, copy the 'Upload Statement' form URL, and test with a statement;
5. Remind them to use only CSV or text-based PDFs—scanned documents are not supported;
6. If customizing categories, guide editing the category list inside the 'Build Category Prompt' node.

Confirm n8n instance and OpenAI key first, then import workflow

Source

Create interactive bank expense reports from statements with OpenAI GPT-4o · incrementors · n8n.io · 2026-08-03

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related