8
n8n 中文网amn8n.com

自动化财务文档处理

高级

这是一个Content Creation, Multimodal AI领域的自动化工作流,包含 76 个节点。主要使用 Set, Code, Merge, SplitOut, GoogleDrive 等节点。 使用Google Gemini OCR的自动化财务文档处理

前置要求
  • Google Drive API 凭证
  • 可能需要目标 API 的认证凭证
  • Google Sheets API 凭证
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "meta": {
    "instanceId": "37f50031da2d48584a7239d61fbf5ae3e1b2415708520d9af5429cf2a73a8c3d",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "ec55993a-2652-4e2d-9e25-3e507f93c487",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -560,
        912
      ],
      "webhookId": "9915b6a2-5823-45b1-9b42-95f428906e87",
      "parameters": {
        "options": {
          "allowFileUploads": true,
          "allowedFilesMimeTypes": "*"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "ce9ddc97-8776-4805-9299-e8898ccd4cdc",
      "name": "拆分输出",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        128,
        1120
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "parsedData['Line Items']"
      },
      "typeVersion": 1
    },
    {
      "id": "a4788bf0-20d2-4e21-9e68-37202475cdcd",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        912
      ],
      "parameters": {
        "width": 340,
        "height": 420,
        "content": "# Mark - 会计师"
      },
      "typeVersion": 1
    },
    {
      "id": "25cc249b-c780-4a34-8cbb-b2aa8a8adf54",
      "name": "确认",
      "type": "n8n-nodes-base.set",
      "position": [
        768,
        912
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "de0be0e9-b008-40c1-84a6-c350ec326840",
              "name": "confirmation",
              "type": "string",
              "value": "All invoices have been processed"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "82edfbf5-53d1-4105-ae08-85fdd4d4a5de",
      "name": "解析数据",
      "type": "n8n-nodes-base.set",
      "position": [
        -48,
        1120
      ],
      "parameters": {
        "options": {
          "ignoreConversionErrors": true
        },
        "assignments": {
          "assignments": [
            {
              "id": "ac4cf2cc-36af-47a4-8638-852302ec2dbd",
              "name": "parsedData",
              "type": "object",
              "value": "={{$json[\"candidates\"][0][\"content\"][\"parts\"][0][\"text\"].replace(/^```json\\s*|\\s*```$/g, '')}}\n"
            }
          ]
        }
      },
      "retryOnFail": true,
      "typeVersion": 3.4
    },
    {
      "id": "b5293bee-dadb-4de1-9142-4efaf432d90f",
      "name": "上传PDF到Google Gemini",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -432,
        1120
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/upload/v1beta/files",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/pdf"
            }
          ]
        },
        "inputDataFieldName": "data0",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "MVIooTcewmtXqO0w",
          "name": "Google Gemini(PaLM) Api account"
        },
        "httpHeaderAuth": {
          "id": "IQ2fzRRHdXqaY5q8",
          "name": "Google API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3679bcea-f0aa-4c4e-82b0-43c147564377",
      "name": "从Google Gemini下载数据",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        -240,
        1120
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-04-17:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"text\": \"Read and analyze this document. If it is an invoice, extract and return the following fields in JSON format:\\\\n- Vendor Name\\\\n- Invoice Number\\\\n- Invoice Date\\\\n- Due Date\\\\n- Total Amount\\\\n- VAT Amount\\\\n- Line Items (Description, Quantity, Unit Price, Total Price)\\\\nIf it is not an invoice, summarize the document content instead in plain text.\"\n        },\n        {\n          \"file_data\": {\n            \"mime_type\": \"application/pdf\",\n            \"file_uri\": {{ JSON.stringify($json.file.uri) }}\n          }\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"responseMimeType\": \"text/plain\",\n    \"maxOutputTokens\": 32768\n  }\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "MVIooTcewmtXqO0w",
          "name": "Google Gemini(PaLM) Api account"
        },
        "httpHeaderAuth": {
          "id": "IQ2fzRRHdXqaY5q8",
          "name": "Google API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2951c2d7-f543-4ea7-acdb-67b9fa9c8d31",
      "name": "ERP表格",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        288,
        1120
      ],
      "parameters": {
        "columns": {
          "value": {
            "Due Date": "={{ $('Parsed Data').item.json.parsedData['Due Date'] }}",
            "Quantity": "={{ $json.Quantity }}",
            "Unit Price": "={{ $json['Unit Price'] }}",
            "VAT Amount": "={{ $('Parsed Data').item.json.parsedData['VAT Amount'] }}",
            "Total Price": "={{ $json['Total Price'] }}",
            "Vendor Name": "={{ $('Parsed Data').item.json.parsedData['Vendor Name'] }}",
            "Invoice Date": "={{ $('Parsed Data').item.json.parsedData['Invoice Date'] }}",
            "Total Amount": "={{ $('Parsed Data').item.json.parsedData['Total Amount'] }}",
            "Invoice Number": "={{ $('Parsed Data').item.json.parsedData['Invoice Number'] }}",
            "Line Item Description": "={{ $json.Description }}"
          },
          "schema": [
            {
              "id": "Vendor Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Vendor Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice Number",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Invoice Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Invoice Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Due Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Due Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Total Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "VAT Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "VAT Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Line Item Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Line Item Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Quantity",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Quantity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Unit Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Unit Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Total Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "cellFormat": "USER_ENTERED"
        },
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Gjm3ALhZZ7I4Wto0CZYNuEr48K-bgLLK6M8K4eyuPq0/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Gjm3ALhZZ7I4Wto0CZYNuEr48K-bgLLK6M8K4eyuPq0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Gjm3ALhZZ7I4Wto0CZYNuEr48K-bgLLK6M8K4eyuPq0/edit?usp=drivesdk",
          "cachedResultName": "Test Invoice Records"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "hgjZaSBUGfCSi6WA",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "d96a6fe2-fe52-4bdc-8199-7c5de0e18d03",
      "name": "当由其他工作流执行时",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "disabled": true,
      "position": [
        -576,
        -2048
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "60c60b57-a29c-4b84-a364-7ff194338a23",
      "name": "合并",
      "type": "n8n-nodes-base.merge",
      "position": [
        416,
        912
      ],
      "parameters": {},
      "typeVersion": 3.1
    },
    {
      "id": "67e50b05-8095-4733-b14d-aac6181163aa",
      "name": "更新文件名",
      "type": "n8n-nodes-base.googleDrive",
      "onError": "continueRegularOutput",
      "position": [
        592,
        912
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "update",
        "newUpdatedFileName": "={{$('Table ERP').first().json['Vendor Name']}} - {{$('Table ERP').first().json['Invoice Number']}}"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "nraVXtOxIKoXG4ac",
          "name": "Google Drive AutoSolutions"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "08e9f03b-c1b5-4d53-8d63-5be9c1f57187",
      "name": "保存发票",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -240,
        912
      ],
      "parameters": {
        "name": "={{ $json.files[0].fileName }}",
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "1nCCa5nxntHv4u-2hSKG9K3cBxrQhA32O",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1nCCa5nxntHv4u-2hSKG9K3cBxrQhA32O",
          "cachedResultName": "Invoices"
        },
        "inputDataFieldName": "data0"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "nraVXtOxIKoXG4ac",
          "name": "Google Drive AutoSolutions"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "65beec00-7e7f-4f2c-8e49-8c5bc9bcac5a",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        832
      ],
      "parameters": {
        "color": 5,
        "width": 1988,
        "height": 528,
        "content": "# 发票处理"
      },
      "typeVersion": 1
    },
    {
      "id": "d9428d0b-67e2-4f01-af5c-418814e5adbf",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        -144
      ],
      "parameters": {
        "color": 5,
        "width": 1604,
        "height": 608,
        "content": "# 费用处理"
      },
      "typeVersion": 1
    },
    {
      "id": "49d55301-45d9-436a-be83-205938ac8e43",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        -64
      ],
      "parameters": {
        "width": 340,
        "height": 480,
        "content": "# Donna - 会计师"
      },
      "typeVersion": 1
    },
    {
      "id": "c638cf56-555c-489d-bb83-bf385ae88af4",
      "name": "Google Drive 触发器",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -544,
        80
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "1vBeKYr7XpinvUUCNYDKOiNIhNcDI5By_",
          "cachedResultUrl": "https://drive.google.com/drive/folders/1vBeKYr7XpinvUUCNYDKOiNIhNcDI5By_",
          "cachedResultName": "Expense Receipts"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "nraVXtOxIKoXG4ac",
          "name": "Google Drive AutoSolutions"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "947a8138-e565-4738-b1c8-8b85068ba6e4",
      "name": "拆分输出1",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        400,
        -80
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "parsedData['Line Items']"
      },
      "typeVersion": 1
    },
    {
      "id": "df7a4279-7e74-4faf-8d5a-b87a657ce9d2",
      "name": "解析数据1",
      "type": "n8n-nodes-base.set",
      "position": [
        240,
        -128
      ],
      "parameters": {
        "options": {
          "ignoreConversionErrors": true
        },
        "assignments": {
          "assignments": [
            {
              "id": "ac4cf2cc-36af-47a4-8638-852302ec2dbd",
              "name": "parsedData",
              "type": "object",
              "value": "={{$json[\"candidates\"][0][\"content\"][\"parts\"][0][\"text\"].replace(/^```json\\s*|\\s*```$/g, '')}}\n"
            }
          ]
        }
      },
      "retryOnFail": true,
      "typeVersion": 3.4
    },
    {
      "id": "32e2ac3c-d6eb-404b-99df-0ed49d18b3fe",
      "name": "上传PDF到Google Gemini1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -160,
        -128
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/upload/v1beta/files",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/pdf"
            }
          ]
        },
        "inputDataFieldName": "data",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "MVIooTcewmtXqO0w",
          "name": "Google Gemini(PaLM) Api account"
        },
        "httpHeaderAuth": {
          "id": "IQ2fzRRHdXqaY5q8",
          "name": "Google API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "2a020ce2-5406-410f-8530-42c8abdc2128",
      "name": "从Google Gemini1下载数据",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        32,
        -128
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-04-17:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"text\": \"Read and analyze this document. If it is an expense receipt, extract and return the following fields in JSON format:\\n- Merchant Name\\n- Transaction Date\\n- Total Amount\\n- Tax Amount (if available)\\n- Payment Method\\n- Line Items (Description, Quantity, Unit Price, Total Price) if available\\nIf it is not an expense receipt, summarize the document content instead in plain text.\"\n        },\n        {\n          \"file_data\": {\n            \"mime_type\": \"application/pdf\",\n            \"file_uri\": {{ JSON.stringify($json.file.uri) }}\n          }\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"responseMimeType\": \"text/plain\",\n    \"maxOutputTokens\": 32768\n  }\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "MVIooTcewmtXqO0w",
          "name": "Google Gemini(PaLM) Api account"
        },
        "httpHeaderAuth": {
          "id": "IQ2fzRRHdXqaY5q8",
          "name": "Google API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "0f89afbd-3b0b-48a6-b92d-838655f3424e",
      "name": "Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        192,
        128
      ],
      "parameters": {
        "columns": {
          "value": {
            "Category": "={{ $json.output.category }}",
            "Quantity": "={{ $('Split Out1').item.json.Quantity }}",
            "Tax Amount": "={{ $('Parsed Data1').item.json.parsedData['Tax Amount'] }}",
            "Unit Price": "={{ $('Split Out1').item.json['Unit Price'] }}",
            "Total Price": "={{ $('Split Out1').item.json['Total Price'] }}",
            "Total Amount": "={{ $('Parsed Data1').item.json.parsedData['Total Amount'] }}",
            "Merchant Name": "={{ $('Parsed Data1').item.json.parsedData['Merchant Name'] }}",
            "Payment Method": "={{ $('Parsed Data1').item.json.parsedData['Payment Method'] }}",
            "Transaction Date": "={{ $('Parsed Data1').item.json.parsedData['Transaction Date'] }}",
            "Line Item Description": "={{ $('Split Out1').item.json.Description }}"
          },
          "schema": [
            {
              "id": "Merchant Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Merchant Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Transaction Date",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Transaction Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Total Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Tax Amount",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Tax Amount",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Category",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Payment Method",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Payment Method",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Line Item Description",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Line Item Description",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Quantity",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Quantity",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Unit Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Unit Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Total Price",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Total Price",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "cellFormat": "USER_ENTERED"
        },
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1zhOaSKk29dp0xzL8u3yVY62FEFxuo1I-9hc1pfAsQjs/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1zhOaSKk29dp0xzL8u3yVY62FEFxuo1I-9hc1pfAsQjs",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1zhOaSKk29dp0xzL8u3yVY62FEFxuo1I-9hc1pfAsQjs/edit?usp=drivesdk",
          "cachedResultName": "Expenses Recording"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "hgjZaSBUGfCSi6WA",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "dbe2be8e-98f0-4c74-81ef-b69d80e7759d",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -368,
        -128
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "nraVXtOxIKoXG4ac",
          "name": "Google Drive AutoSolutions"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "dc065b83-bae9-4cde-bfc4-2440964d600c",
      "name": "便签 4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -992,
        -1136
      ],
      "parameters": {
        "color": 5,
        "width": 2136,
        "height": 512,
        "content": "# 费用处理"
      },
      "typeVersion": 1
    },
    {
      "id": "84d2f0ab-ae05-452b-8b00-76c74f167959",
      "name": "便签 5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        -1056
      ],
      "parameters": {
        "width": 340,
        "height": 420,
        "content": "# Victor - 财务总监"
      },
      "typeVersion": 1
    },
    {
      "id": "f8c79b50-6d77-45f1-b7df-4b48a992402d",
      "name": "Google Drive Trigger1",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -480,
        -976
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "16l6LegAqkV6axZT9WPwr_p2-20VqeiRD",
          "cachedResultUrl": "https://drive.google.com/drive/folders/16l6LegAqkV6axZT9WPwr_p2-20VqeiRD",
          "cachedResultName": "Bank Statements"
        }
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "nraVXtOxIKoXG4ac",
          "name": "Google Drive AutoSolutions"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "529732d1-eee3-471d-80b7-0ac6320ed6d2",
      "name": "上传PDF到Google Gemini2",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        48,
        -976
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/upload/v1beta/files",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "binaryData",
        "sendHeaders": true,
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/pdf"
            }
          ]
        },
        "inputDataFieldName": "data",
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "MVIooTcewmtXqO0w",
          "name": "Google Gemini(PaLM) Api account"
        },
        "httpHeaderAuth": {
          "id": "IQ2fzRRHdXqaY5q8",
          "name": "Google API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "1765ea24-57c2-4c5f-9ca0-70338934195d",
      "name": "从Google Gemini2下载数据",
      "type": "n8n-nodes-base.httpRequest",
      "onError": "continueErrorOutput",
      "position": [
        256,
        -976
      ],
      "parameters": {
        "url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-preview-04-17:generateContent",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"contents\": [\n    {\n      \"role\": \"user\",\n      \"parts\": [\n        {\n          \"text\": \"Read and analyze this document. If it is a bank statement, extract and return the following fields in JSON format:\\n- Txn ID\\n- Date\\n- Description / Payee\\n- Debit (-)\\n- Credit (+)\\n- Currency\\n- Running Balance\\n- Notes / Category (optional)\\n\\nIf it is not a bank statement, summarize the document content instead in plain text.\"\n        },\n        {\n          \"file_data\": {\n            \"mime_type\": \"application/pdf\",\n            \"file_uri\": {{ JSON.stringify($json.file.uri) }}\n          }\n        }\n      ]\n    }\n  ],\n  \"generationConfig\": {\n    \"responseMimeType\": \"text/plain\",\n    \"maxOutputTokens\": 32768\n  }\n}\n",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "nodeCredentialType": "googlePalmApi"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "MVIooTcewmtXqO0w",
          "name": "Google Gemini(PaLM) Api account"
        },
        "httpHeaderAuth": {
          "id": "IQ2fzRRHdXqaY5q8",
          "name": "Google API"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "6d94b80f-914f-4c60-b0b8-1fec176ba707",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        736,
        -976
      ],
      "parameters": {
        "columns": {
          "value": {
            "Date": "={{ $json.Date }}",
            "Currency": "={{ $json.Currency }}",
            "Debit (-)": "={{ $json['Debit (-)'] }}",
            "Credit (+)": "={{ $json['Credit (+)'] }}",
            "Running Balance": "={{ $json['Running Balance'] }}",
            "Description / Payee": "={{ $json['Description / Payee'] }}"
          },
          "schema": [
            {
              "id": "Transaction ID",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Transaction ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Date",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Description / Payee",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Description / Payee",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Debit (-)",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Debit (-)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Credit (+)",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Credit (+)",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Currency",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Running Balance",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Running Balance",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Notes / Category",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Notes / Category",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "cellFormat": "USER_ENTERED"
        },
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SOknw2I6hgXwwaaRHPPogtGjCP4pUjK-xsfIYYwJnvo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1SOknw2I6hgXwwaaRHPPogtGjCP4pUjK-xsfIYYwJnvo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SOknw2I6hgXwwaaRHPPogtGjCP4pUjK-xsfIYYwJnvo/edit?usp=drivesdk",
          "cachedResultName": "Bank Transactions Record"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "hgjZaSBUGfCSi6WA",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "55f393cc-9c47-42db-8803-f1e090459605",
      "name": "Google Drive1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -256,
        -976
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "operation": "download"
      },
      "credentials": {
        "googleDriveOAuth2Api": {
          "id": "nraVXtOxIKoXG4ac",
          "name": "Google Drive AutoSolutions"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "4b5d634e-53f9-41d5-938c-7cf6efe61411",
      "name": "获取简报",
      "type": "n8n-nodes-base.set",
      "position": [
        912,
        -976
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9f21fb2a-c48b-4918-ba56-c98384e1546d",
              "name": "response",
              "type": "string",
              "value": "Recorded!"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "03bc404a-d364-42b4-900f-ca61e4dd9b67",
      "name": "编辑字段1",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        128
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "9f21fb2a-c48b-4918-ba56-c98384e1546d",
              "name": "response",
              "type": "string",
              "value": "Recorded!"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "347e16d9-febc-4f44-8539-112ca95e3df5",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        512,
        -976
      ],
      "parameters": {
        "jsCode": "const raw = $json.candidates[0].content.parts[0].text;\nconst match = raw.match(/```json\\s*([\\s\\S]*?)\\s*```/);\nlet body   = (match ? match[1] : raw)\n\t           .replace(/[\\u0000-\\u001F\\u007F-\\u009F]/g, '')\n\t           .replace(/,\\s*([}\\]])/g, '$1');\n\nlet data;\ntry {\n\tdata = JSON.parse(body);            // ← will throw a readable n8n error if still bad\n} catch (err) {\n\tthrow new Error('LLM returned invalid JSON ➜ ' + err.message);\n}\n\n// Normalise: array of rows no matter what\nif (!Array.isArray(data)) data = data.transactions || [data];\nreturn data.map(t => ({ json: t }));\n"
      },
      "typeVersion": 2
    },
    {
      "id": "5ebbafe9-d67e-4e86-be8c-e02c79f177d4",
      "name": "基础 LLM 链",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -160,
        128
      ],
      "parameters": {
        "text": "={{ $('Download Data from Google Gemini1').item.json.candidates[0].content.parts[0].text }}",
        "messages": {
          "messageValues": [
            {
              "message": "=You are EXPENSE-CLASSIFIER, an expert bookkeeping agent.\n\nTask  \n• Read the input text of one expense (bank-transaction line, receipt, or invoice memo).  \n• Choose exactly **one** category from the allowed list below that best fits.  \n• If no perfect fit exists, pick the closest logical category (never return “unknown”).  \n• Respond ONLY with valid JSON that matches the schema in the next block—no extra keys, no markdown.\n\nAllowed categories  \n- Cost of Goods Sold  \n- Advertising & Marketing  \n- Payroll & Wages  \n- Employee Benefits  \n- Contract Labor  \n- Rent & Leases  \n- Utilities  \n- Office Supplies & G&A  \n- Software & Cloud Subscriptions  \n- Travel Meals & Entertainment  \n- Professional Services  \n- Insurance  \n- Repairs & Maintenance  \n- Taxes & Licenses  \n- Interest Expense  \n- Depreciation & Amortization  \n- Other Miscellaneous\n"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 1.6
    },
    {
      "id": "f1a9203a-0d21-46f0-aa9a-afff675427dc",
      "name": "OpenRouter聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -160,
        304
      ],
      "parameters": {
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "9fwHsRBaQUkeEsGv",
          "name": "OpenRouter ML Account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9638204f-cb80-4fb5-a146-055160fd1437",
      "name": "结构化输出解析器",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        -16,
        304
      ],
      "parameters": {
        "jsonSchemaExample": "{\n  \"category\": \"Advertising & Marketing\"\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "1cbde03d-4562-4b08-9001-e3e13bc7cf9b",
      "name": "AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -352,
        -2048
      ],
      "parameters": {
        "text": "={{ $json }}",
        "options": {
          "systemMessage": "You are FinanceDataBot, a specialized agent for extracting and analyzing financial data from spreadsheets.\n\nPRIMARY FUNCTION:\nYour sole purpose is to access, extract, and analyze data from financial spreadsheets when requested by an orchestrator agent. You have access to three key spreadsheets:\n1. Invoices - Contains invoice records with details on clients, amounts, dates, and payment status\n2. Expenses - Contains expense records with categories, amounts, dates, and other relevant details\n3. Transactions - Contains bank transaction records with dates, descriptions, amounts, and transaction types\n\nRESPONSE GUIDELINES:\n1. Always respond with accurate, concise data extractions based on the specific request\n2. Format numerical data appropriately (currency with 2 decimal places)\n3. When providing lists, use clean table formatting\n4. Include summary statistics when appropriate (totals, averages, etc.)\n5. Never share opinions or engage in casual conversation - stay focused on data extraction only\n\nDATA EXTRACTION CAPABILITIES:\n- Filter by date ranges (e.g., \"invoices for December\")\n- Sort and limit results (e.g., \"last 10 transactions\")\n- Calculate aggregates (e.g., \"total value of invoices\")\n- Perform basic analysis (e.g., \"highest expense category\")\n- Identify patterns or anomalies when specifically requested\n\nERROR HANDLING:\n- If data is missing or unavailable, clearly state what information could not be retrieved\n- If a request is ambiguous, ask for clarification on specific parameters needed\n- If a request is outside your capabilities, explain what you can and cannot provide\n\nSECURITY CONSIDERATIONS:\n- You only have access to the three specified spreadsheets\n- Do not attempt to access or modify any other data sources\n- Treat all financial data as confidential\n\nExample requests you should be able to handle:\n- \"What are the last 10 bank transactions?\"\n- \"What is the total value of invoices for December 2023?\"\n- \"List all unpaid invoices sorted by amount\"\n- \"What was our highest expense category last month?\"\n- \"Show me transactions over $1000 in the past week\"\n- \"Calculate the average invoice amount by client\""
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "a0d38cbe-d401-458d-afde-7b46172f1b9a",
      "name": "OpenRouter Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "position": [
        -448,
        -1808
      ],
      "parameters": {
        "model": "openai/gpt-4.1",
        "options": {}
      },
      "credentials": {
        "openRouterApi": {
          "id": "9fwHsRBaQUkeEsGv",
          "name": "OpenRouter ML Account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8fea6832-8064-46d3-a71e-eb42b325e58b",
      "name": "发票",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -128,
        -1808
      ],
      "parameters": {
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "rangeDefinition": "detectAutomatically"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Gjm3ALhZZ7I4Wto0CZYNuEr48K-bgLLK6M8K4eyuPq0/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1Gjm3ALhZZ7I4Wto0CZYNuEr48K-bgLLK6M8K4eyuPq0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1Gjm3ALhZZ7I4Wto0CZYNuEr48K-bgLLK6M8K4eyuPq0/edit?usp=drivesdk",
          "cachedResultName": "Test Invoice Records"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "hgjZaSBUGfCSi6WA",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "39e1c9dd-e85d-4548-8c62-24209f4b8fc0",
      "name": "费用",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        -32,
        -1808
      ],
      "parameters": {
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "rangeDefinition": "detectAutomatically"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1zhOaSKk29dp0xzL8u3yVY62FEFxuo1I-9hc1pfAsQjs/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1zhOaSKk29dp0xzL8u3yVY62FEFxuo1I-9hc1pfAsQjs",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1zhOaSKk29dp0xzL8u3yVY62FEFxuo1I-9hc1pfAsQjs/edit?usp=drivesdk",
          "cachedResultName": "Expenses Recording"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "hgjZaSBUGfCSi6WA",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "df86bfde-6554-4bfd-8cfe-3cc2cfc6d4f8",
      "name": "交易",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        64,
        -1808
      ],
      "parameters": {
        "options": {
          "dataLocationOnSheet": {
            "values": {
              "rangeDefinition": "detectAutomatically"
            }
          }
        },
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SOknw2I6hgXwwaaRHPPogtGjCP4pUjK-xsfIYYwJnvo/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1SOknw2I6hgXwwaaRHPPogtGjCP4pUjK-xsfIYYwJnvo",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1SOknw2I6hgXwwaaRHPPogtGjCP4pUjK-xsfIYYwJnvo/edit?usp=drivesdk",
          "cachedResultName": "Bank Transactions Record"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "hgjZaSBUGfCSi6WA",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.5
    },
    {
      "id": "bf1db04b-5b67-4334-ab21-1e6e4d40fa6a",
      "name": "编辑字段2",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        -2048
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "599d7fa9-e8c5-4c3a-8957-f94c498014bd",
              "name": "Response",
              "type": "string",
              "value": "={{ $json }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "64afa6b9-e8eb-4d73-b124-c19f4051e75d",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -960,
        -2080
      ],
      "parameters": {
        "width": 340,
        "height": 420,
        "content": "# Andrew - 首席财务官"
      },
      "typeVersion": 1
    },
    {
      "id": "583b7a38-910e-4c9f-8c8d-cd0997addc60",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        -2160
      ],
      "parameters": {
        "color": 5,
        "width": 1232,
        "height": 520,
        "content": "# 财务"
      },
      "typeVersion": 1
    },
    {
      "id": "953aaa49-78d5-44b3-846b-c139b2c1d9cb",
      "name": "便签25",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3792,
        1104
      ],
      "parameters": {
        "color": 7,
        "width": 1344,
        "height": 816,
        "content": "# AutoSolutions.ai - AI咨询服务"
      },
      "typeVersion": 1
    },
    {
      "id": "b39dfed5-8164-4ea1-939f-6ed5ade480ba",
      "name": "### 替换 Airtable 连接",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3984,
        -2480
      ],
      "parameters": {
        "width": 784,
        "height": 2256,
        "content": "# 🤖 AI驱动的财务文档处理工作流"
      },
      "typeVersion": 1
    },
    {
      "id": "82e8c619-a09b-42bf-b6b9-773d20e821ac",
      "name": "便签10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3120,
        -848
      ],
      "parameters": {
        "width": 784,
        "height": 640,
        "content": "# 🛠️ 设置要求"
      },
      "typeVersion": 1
    },
    {
      "id": "d842268b-9d80-42da-952c-a0681736a584",
      "name": "便签11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3120,
        -2480
      ],
      "parameters": {
        "width": 784,
        "height": 1600,
        "content": "# 🎯 使用方法"
      },
      "typeVersion": 1
    },
    {
      "id": "114a10ca-24f0-492d-af38-45795bab1666",
      "name": "📄 发票处理文档",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        816
      ],
      "parameters": {
        "color": 5,
        "width": 772,
        "height": 1112,
        "content": "# 📄 发票处理部分"
      },
      "typeVersion": 1
    },
    {
      "id": "b838b4c4-545c-411d-b6cd-9041479f72e9",
      "name": "Mark - 会计师",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        832
      ],
      "parameters": {
        "color": 6,
        "width": 324,
        "height": 528,
        "content": "# Mark - 会计师 👨‍💼"
      },
      "typeVersion": 1
    },
    {
      "id": "de948508-c38d-47aa-9a57-3972a854fd3f",
      "name": "💾 保存文件说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        1392
      ],
      "parameters": {
        "color": 3,
        "width": 268,
        "height": 488,
        "content": "# 📤 步骤1:文件上传与存储"
      },
      "typeVersion": 1
    },
    {
      "id": "d76a1641-f669-4ca7-a72e-ea3a5f3cd6c9",
      "name": "🤖 上传到AI说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1056,
        1392
      ],
      "parameters": {
        "color": 3,
        "width": 220,
        "height": 488,
        "content": "# 🤖 步骤2:AI上传"
      },
      "typeVersion": 1
    },
    {
      "id": "f91e1f93-c743-400a-bbd9-520edd6169d0",
      "name": "🧠 数据提取说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -816,
        1392
      ],
      "parameters": {
        "color": 3,
        "width": 252,
        "height": 488,
        "content": "# 🧠 步骤3:数据提取"
      },
      "typeVersion": 1
    },
    {
      "id": "aa42f2bd-4ee3-45f3-a671-33eff825a42e",
      "name": "📋 JSON解析说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -544,
        1392
      ],
      "parameters": {
        "color": 3,
        "width": 236,
        "height": 488,
        "content": "# 📋 步骤4:JSON解析"
      },
      "typeVersion": 1
    },
    {
      "id": "4207bb87-5651-4107-afd1-c74fa3ffe2e9",
      "name": "📑 拆分项目说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -288,
        1392
      ],
      "parameters": {
        "color": 3,
        "width": 236,
        "height": 488,
        "content": "# 📑 步骤5:行项目处理"
      },
      "typeVersion": 1
    },
    {
      "id": "09ea2e0e-3455-4a4f-b104-caf7e145ed59",
      "name": "📊 保存到表格说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        1392
      ],
      "parameters": {
        "color": 3,
        "width": 268,
        "height": 488,
        "content": "# 📊 步骤6:保存到电子表格"
      },
      "typeVersion": 1
    },
    {
      "id": "7696a262-8c9c-4f0a-89ba-0998fef40fcb",
      "name": "🔗 合并说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        256,
        1392
      ],
      "parameters": {
        "color": 3,
        "width": 218,
        "height": 486,
        "content": "# 🔗 步骤7:数据合并"
      },
      "typeVersion": 1
    },
    {
      "id": "f6db208f-ead8-4762-afde-d82c511344e8",
      "name": "📝 重命名说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        496,
        1392
      ],
      "parameters": {
        "color": 3,
        "width": 202,
        "height": 486,
        "content": "# 📝 步骤8:文件重命名"
      },
      "typeVersion": 1
    },
    {
      "id": "c23af4ed-ad50-4992-8bd2-fb884121e17c",
      "name": "✅ 确认说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        720,
        1392
      ],
      "parameters": {
        "color": 3,
        "width": 250,
        "height": 486,
        "content": "# ✅ 步骤9:确认"
      },
      "typeVersion": 1
    },
    {
      "id": "619818b5-2e30-46ef-a1fe-c9653e9fe662",
      "name": "🧾 费用处理文档",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        -448
      ],
      "parameters": {
        "color": 5,
        "width": 772,
        "height": 1232,
        "content": "# 🧾 费用处理部分"
      },
      "typeVersion": 1
    },
    {
      "id": "be419798-2cc6-4819-9a1d-59201efe77c3",
      "name": "📁 费用触发器说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        176
      ],
      "parameters": {
        "color": 4,
        "width": 492,
        "height": 296,
        "content": "# 📁 费用触发器"
      },
      "typeVersion": 1
    },
    {
      "id": "791fb721-f346-42d8-9628-1d5b2db5ab24",
      "name": "🏷️ 分类说明",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        640,
        -144
      ],
      "parameters": {
        "color": 4,
        "width": 492,
        "height": 296,
        "content": "# 🏷️ AI分类"
      },
      "typeVersion": 1
    },
    {
      "id": "39b5e552-93b9-437b-b2ce-2ca403a7cd8a",
      "name": "🏦 Bank Statement Processing Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        -1328
      ],
      "parameters": {
        "color": 5,
        "width": 772,
        "height": 856,
        "content": "# 🏦 BANK STATEMENT PROCESSING SECTION\n\n## 🎯 Purpose\nThis section monitors a Google Drive folder for new bank statements. Victor, the AI Controller, extracts transaction data for reconciliation and analysis.\n\n## 🔄 Process Flow\n1. **📁 Drive Monitor**: Watches \"Bank Statements\" folder every minute\n2. **📥 File Download**: Downloads new PDF bank statements\n3. **🤖 AI Processing**: Google Gemini extracts transaction data\n4. **🔄 Data Parsing**: Custom code handles multiple transactions\n5. **📊 Data Storage**: Information saved to \"Bank Transactions Record\" spreadsheet\n6. **✅ Completion**: Process confirmation\n\n## 📋 Extracted Fields\n- Transaction ID\n- Date\n- Description / Payee\n- Debit (-)\n- Credit (+)\n- Currency\n- Running Balance\n- Notes / Category (optional)\n\n## ⚙️ Configuration Notes\n- Monitors folder every minute for new files\n- Processes PDF bank statements automatically\n- Custom JavaScript code handles transaction arrays\n- Error handling continues processing other files\n- Supports multiple transaction formats"
      },
      "typeVersion": 1
    },
    {
      "id": "cba011da-354b-4c58-9942-f6f5fb6b4135",
      "name": "Victor - Controller",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        -1136
      ],
      "parameters": {
        "color": 6,
        "width": 324,
        "height": 512,
        "content": "# Victor - Controller 👨‍💼\n\n**Role**: Bank Statement Processing & Transaction Reconciliation\n\n**Responsibilities**:\n- ✅ Extract transaction details\n- ✅ Process multiple transactions per statement\n- ✅ Maintain running balances\n- ✅ Handle various bank formats\n\n**AI Capabilities**:\n- 🧠 Multi-transaction extraction\n- 📊 Balance reconciliation\n- 🔄 Format standardization"
      },
      "typeVersion": 1
    },
    {
      "id": "c3b83adc-d38c-4b18-ae37-a5e801c7b4d5",
      "name": "🔄 Bank Parser Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1168,
        -1136
      ],
      "parameters": {
        "color": 4,
        "width": 348,
        "height": 504,
        "content": "# 🔄 CUSTOM TRANSACTION PARSER\n\n**Purpose**: Parse multiple bank transactions from AI response\n\n**Features**:\n- 🧹 Cleans JSON formatting\n- 📊 Handles multiple response formats\n- 🔄 Converts to n8n array format\n- ⚠️ Comprehensive error handling\n\n**Output**: Individual transaction objects"
      },
      "typeVersion": 1
    },
    {
      "id": "173fbf7e-f00e-4ab8-a1b9-a63aacb17648",
      "name": "📈 Financial Analysis Documentation",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2224,
        -2480
      ],
      "parameters": {
        "color": 5,
        "width": 756,
        "height": 1104,
        "content": "# 📈 FINANCIAL ANALYSIS AGENT SECTION\n\n## 🎯 Purpose\nAndrew, the AI CFO, provides intelligent financial analysis and reporting. He can access all three financial spreadsheets and answer complex queries using natural language.\n\n## 🔄 Process Flow\n1. **▶️ Manual Trigger**: Execute when financial analysis is needed\n2. **🤖 AI Agent**: Uses advanced LLM for data analysis\n3. **📊 Data Access**: Connects to all three Google Sheets\n4. **💬 Natural Language**: Processes queries in plain English\n5. **📈 Analysis**: Generates insights and reports\n6. **📋 Response**: Formatted results and recommendations\n\n## 🗃️ Data Access\n- **📄 Invoices**: Client billing and payment tracking\n- **🧾 Expenses**: Categorized expense analysis\n- **🏦 Transactions**: Bank account reconciliation\n\n## 💡 Query Examples\n- \"What are the last 10 bank transactions?\"\n- \"What is the total value of invoices for December 2023?\"\n- \"List all unpaid invoices sorted by amount\"\n- \"What was our highest expense category last month?\"\n- \"Show me transactions over $1000 in the past week\"\n- \"Calculate the average invoice amount by client\"\n- \"Compare Q3 vs Q4 expenses by category\"\n- \"Generate a cash flow summary for the last quarter\"\n\n## 🤖 AI Capabilities\n- **📊 Data Analysis**: Complex calculations and aggregations\n- **📈 Trend Analysis**: Identify patterns and insights\n- **📋 Report Generation**: Structured financial reports\n- **💬 Natural Language**: No SQL or technical knowledge required\n- **🔍 Data Mining**: Find specific transactions or patterns\n\n## ⚙️ Configuration Notes\n- Uses GPT-4.1 via OpenRouter for advanced reasoning\n- Connected to all three financial spreadsheets as tools\n- Disabled by default - enable when analysis is needed\n- Maintains data confidentiality and security"
      },
      "typeVersion": 1
    },
    {
      "id": "3bca707d-5591-48aa-9d2b-463f3d116b87",
      "name": "Andrew - CFO",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1328,
        -2160
      ],
      "parameters": {
        "color": 6,
        "width": 308,
        "height": 512,
        "content": "# Andrew - CFO 👨‍💼\n\n**Role**: Financial Analysis & Strategic Reporting\n\n**Responsibilities**:\n- ✅ Generate financial insights\n- ✅ Answer complex queries\n- ✅ Create executive reports\n- ✅ Provide strategic recommendations\n\n**AI Capabilities**:\n- 🧠 Advanced data analysis\n- 📊 Multi-source data synthesis\n- 💬 Natural language processing\n- 📈 Trend identification"
      },
      "typeVersion": 1
    },
    {
      "id": "c12b117e-e2f7-4c01-895a-5d30f1b1d973",
      "name": "📊 Analysis Trigger Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -2160
      ],
      "parameters": {
        "color": 4,
        "width": 300,
        "height": 518,
        "content": "# 📊 ANALYSIS TRIGGER\n\n**Purpose**: Manual trigger for financial analysis queries\n\n**Usage**:\n- 🔘 Enable this trigger when analysis is needed\n- 💬 Send financial queries to the AI agent\n- 📈 Get insights from all your financial data\n\n**Note**: Disabled by default for security"
      },
      "typeVersion": 1
    },
    {
      "id": "47cd562d-1c49-46c4-94ab-ce6bd0f2a2de",
      "name": "🗃️ Data Tools Instructions",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        624,
        -2160
      ],
      "parameters": {
        "color": 4,
        "width": 302,
        "height": 520,
        "content": "# 🗃️ DATA ACCESS TOOLS\n\n**Purpose**: Connect AI agent to financial spreadsheets\n\n**Tools Available**:\n- 📄 **Invoices Tool**: Invoice records and billing data\n- 🧾 **Expenses Tool**: Categorized expense tracking\n- 🏦 **Transactions Tool**: Bank transaction history\n\n**Features**:\n- 🔍 Auto-detect data ranges\n- 📊 Full spreadsheet access\n- 🔐 Secure authentication\n- 📈 Real-time data access"
      },
      "typeVersion": 1
    },
    {
      "id": "e2d55436-ebd7-48a8-9b99-02c04444afad",
      "name": "Donna - Accountant",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1344,
        -144
      ],
      "parameters": {
        "color": 6,
        "width": 324,
        "height": 608,
        "content": "# Donna - Accountant 👩‍💼\n\n**Role**: Expense Processing & Categorization Specialist\n\n**Responsibilities**:\n- ✅ Extract merchant & transaction details\n- ✅ Categorize expenses automatically\n- ✅ Process receipt line items\n- ✅ Ensure compliance categorization\n\n**AI Capabilities**:\n- 🧠 Smart expense categorization\n- 📋 Receipt data extraction\n- 🏷️ 17-category classification system"
      },
      "typeVersion": 1
    },
    {
      "id": "40503797-869e-46ec-ad59-83f94f78d757",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1376,
        800
      ],
      "parameters": {
        "color": 7,
        "width": 2416,
        "height": 1152,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "e3db55b4-86fe-44f8-9bf8-3e97f5db942f",
      "name": "便签 14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1376,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 2544,
        "height": 688,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "c3f4650a-f442-417d-b446-af32cb3bfeca",
      "name": "便签15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1376,
        -1168
      ],
      "parameters": {
        "color": 7,
        "width": 2928,
        "height": 576,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "5720a9c7-16ec-412b-80ed-a32c70eeb9f6",
      "name": "便签 16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1376,
        -2208
      ],
      "parameters": {
        "color": 7,
        "width": 2352,
        "height": 608,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "423bea12-2767-48d3-844b-26815d45960a",
      "name": "便签26",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3520,
        80
      ],
      "parameters": {
        "color": 7,
        "width": 848,
        "height": 848,
        "content": "![My Image](https://i.postimg.cc/3RCvSmDS/Untitled-design-10.png)"
      },
      "typeVersion": 1
    },
    {
      "id": "904576db-3e5a-4b7d-bb64-0f181163ed51",
      "name": "便签 27",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1936,
        -3376
      ],
      "parameters": {
        "color": 7,
        "width": 1312,
        "height": 784,
        "content": "![My Image](https://i.postimg.cc/k4nQdT9X/replicate-prediction-w27bjb3hxxrm80csj5t8211288.jpg)"
      },
      "typeVersion": 1
    },
    {
      "id": "4b28450e-ede0-4ac3-8120-19c5dea201ab",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        -3504
      ],
      "parameters": {
        "width": 544,
        "height": 80,
        "content": "# Virtual Accounting Department"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "Code": {
      "main": [
        [
          {
            "node": "Google Sheets1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Update File Name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Expenses": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Invoices": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Table ERP",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Table ERP": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Split Out1": {
      "main": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parsed Data": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Upload PDF to Google Gemini1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parsed Data1": {
      "main": [
        [
          {
            "node": "Split Out1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Invoice": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Transactions": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive1": {
      "main": [
        [
          {
            "node": "Upload PDF to Google Gemini2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Sheets1": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Basic LLM Chain": {
      "main": [
        [
          {
            "node": "Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update File Name": {
      "main": [
        [
          {
            "node": "Confirmation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger1": {
      "main": [
        [
          {
            "node": "Google Drive1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenRouter Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Basic LLM Chain",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "Upload PDF to Google Gemini",
            "type": "main",
            "index": 0
          },
          {
            "node": "Save Invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload PDF to Google Gemini": {
      "main": [
        [
          {
            "node": "Download Data from Google Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload PDF to Google Gemini1": {
      "main": [
        [
          {
            "node": "Download Data from Google Gemini1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload PDF to Google Gemini2": {
      "main": [
        [
          {
            "node": "Download Data from Google Gemini2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Data from Google Gemini": {
      "main": [
        [
          {
            "node": "Parsed Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload PDF to Google Gemini",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Data from Google Gemini1": {
      "main": [
        [
          {
            "node": "Parsed Data1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload PDF to Google Gemini1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Data from Google Gemini2": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Upload PDF to Google Gemini2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 内容创作, 多模态 AI

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量76
分类2
节点类型16
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Didac Fernandez

Didac Fernandez

@didac-fg

Pro VibeCoder & Master Jedi in Business Applied GenAI | Expert in Process Automation and AI Business Transformation | IT & Cyber

外部链接
在 n8n.io 查看

分享此工作流