ChatGPT创意写作AI 评分 · 83/100AI 辅助编辑·未发现明显提示词注入风险n8n.io

用 n8n + OpenAI 自动把银行对账单转成交互式费用报表

上传 CSV 或文本 PDF → 解析交易 → AI 分类商户 → 生成含图表、月度汇总和重复扣款检测的 HTML 报告

有一点经验步骤流程提示词贴士
给谁
有 n8n 实例、需要自动整理银行对账单的个人或小团队
你会得到
获得一个带分类条形图、月度表格、重复扣款年化成本、AI 文字解读和 CSV 下载的交互式网页报告
你需要
n8n

硬约束

前置条件:可访问的 n8n 实例(自托管或云版)、OpenAI API 密钥。输入为银行导出的 CSV 或文本型 PDF(扫描件/图片 PDF 不支持)。费用取决于 OpenAI API 调用量(本模板使用 gpt-4o-mini)。

他们做了什么

incrementors 在 n8n 官方模板库发布了一个工作流模板,允许用户通过表单上传银行对账单(CSV 或文本 PDF),自动解析交易、用 OpenAI 模型分类商户、计算汇总数据,最终生成包含图表、重复扣款检测和 AI 文字解读的交互式 HTML 报告。模板包含 19 个节点,使用 gpt-4o-mini 模型,支持多种国际银行格式。

效果如何

作者报告该模板可自动处理 US、UK、Indian、European 格式的对账单,无需手动配置分隔符或日期格式(author_report)。输出包括分类条形图、月度收支表、重复扣款年化成本、最大交易列表、AI 生成的文字总结和待核查问题,以及可下载的 CSV。

值得知道

扫描件或图片 PDF 无法提取文本,需改用银行导出的 CSV(来源明确声明)。AI 分类基于商户名称推断,可能出错,报告底部已声明需人工复核。两个 AI Agent 共享同一个 OpenAI Chat Model 节点,可替换为 Anthropic、Gemini、Groq 或 Ollama。重复扣款检测由代码节点基于金额稳定性和日期相似度计算,非模型猜测。年化成本 = 典型扣款 × 12,非账单实际数字。本站未实测,reproduction=not_tested。

n8n 工作流模板

结构已检查 · 未实际运行

下载后在 n8n 选择“Import from File”,或复制 JSON 后粘贴到编辑器。先配置自己的账号,再用测试数据运行;模板默认未启用。

配置与测试清单

需要绑定的凭证

  • 导入后按各需鉴权节点绑定你自己的凭证;本附件不含原作者密钥。

需要替换的配置

  • 源模板来自 n8n 公开库 #17753(约 19 个节点)。导入后先保持未启用,核对触发器、表达式与外部 API 端点。
  • Sticky Note 中的说明仅供参考;按自己的账号、表结构或频道 ID 替换占位配置。

测试输入与预期结果

  • 在测试环境手动执行一次主路径,确认每个需凭证的节点已连接且无鉴权错误。
  • 用一条合成/脱敏样例数据跑通,核对输出字段与下游写入目标,再考虑生产启用。

模板处理说明

  • 已移除原作者凭证绑定、webhookId 与执行数据,工作流设为未启用;节点、连线与原文提示词保持原样。未在 n8n 中实际运行。
  • 未改业务逻辑;运行前请自行核对密钥、配额与隐私合规。

模板获取日期: 2026-10-24

步骤

  1. 配置触发器与上传表单

    在 n8n 中导入工作流后,找到「Upload Statement」表单触发器节点。该节点已配置为接受 .csv、.txt、.pdf 文件。无需修改即可使用,但可根据需要调整表单标题或描述。激活工作流后,复制该节点的生产环境 URL,用于后续上传对账单。

  2. 检测文件类型并提取文本

    工作流通过「Is it a PDF?」IF 节点检查上传文件的 MIME 类型。若为 PDF,送入「Extract PDF Text」节点提取文本;否则送入「Extract CSV Text」节点读取文本。两个分支在「Combine File Branches」合并节点汇合,输出单一原始文本字符串。

  3. 解析交易记录

    「Parse Transactions」代码节点自动检测分隔符(逗号/分号/制表符/竖线)、日期格式(DD/MM 或 MM/DD)和列布局,输出规范化交易列表和去重后的商户列表。支持 US、UK、Indian、European 多种格式。若无法识别交易,会抛出明确错误提示。

  4. AI 分类商户

    「Build Category Prompt」代码节点构造提示词,将去重商户列表发送给 OpenAI 模型。模型为每个商户分配固定类别(如 Housing、Groceries、Subscriptions 等)和可读名称。随后「Categorize Payees」AI Agent 节点执行分类,要求模型仅返回纯 JSON、不编造商户、不做算术。

    运行提示词 · 来源原文。Categorize Payees 节点的 systemMessage 字段

    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.

    运行提示词 · 本站建议版本。Build Category Prompt 节点 jsCode 构造的用户提示词;{{merchant_list}} 为运行时变量

    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 Totals」代码节点基于分类结果计算:支出/收入总额、分类占比、月度收支、最大单笔交易、重复扣款检测(按商户、金额稳定性、扣款日期相似度判断)及年化成本。未分类交易自动归入 Other 或 Income。

  6. 生成 AI 文字解读

    「Build Insights Prompt」代码节点将计算好的汇总数据格式化为提示词,送入「Insights Agent」AI Agent 节点。模型生成一段_plain language_总结、若干观察(带 Watch/Notable/Positive 标签)、重复扣款说明和待核查问题。要求模型不给出投资建议、不编造数字、不假设趋势。

    运行提示词 · 来源原文。Insights Agent 节点的 systemMessage 字段

    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.

    运行提示词 · 本站建议版本。Build Insights Prompt 节点 jsCode 构造的用户提示词;{{variables}} 为运行时替换

    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. 构建并返回 HTML 报告

    「Build Report Page」代码节点组装交互式 HTML 页面:含汇总卡片、分类条形图、月度表格(多月份时)、重复扣款表(含 stopped 标记)、最大交易表、AI 解读区、全部交易可筛选表格及 CSV 下载链接。最后「Show Report」表单节点将 HTML 作为响应直接展示。

可复制提示词

搭建指导 · 本站建议版本。交给搭建助手,协助用户导入模板、配置凭证和测试

这一段是提示词,页面不会在这里插入广告。

你是一个 n8n 工作流搭建助手。用户想要复现「银行对账单自动转费用报表」模板。请按以下顺序协助:
1. 确认用户已有 n8n 实例(自托管或云版)和 OpenAI API 密钥;
2. 指导从 https://n8n.io/workflows/17753/ 导入工作流 JSON;
3. 在「OpenAI Chat Model」节点配置 API 凭证,确认两个 AI Agent 节点均连接该模型;
4. 激活工作流,复制「Upload Statement」表单 URL 进行测试;
5. 提醒仅使用 CSV 或文本型 PDF,扫描件不支持;
6. 如需自定义类别,指导编辑「Build Category Prompt」节点内的类别列表。

先确认 n8n 实例和 OpenAI 密钥,再导入工作流

来源

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

留言与反馈

试过这个方法吗?分享效果、遇到的问题或改进建议。留言审核后公开,请勿填写敏感信息。

正在加载…

    相关用例