8
n8n 中文网amn8n.com

来自xlsx、xls或csv文件的智能报告生成器,具有基于AI的分析

高级

这是一个Document Extraction, Multimodal AI领域的自动化工作流,包含 35 个节点。主要使用 If, Set, Code, Wait, Switch 等节点。 使用Gemini AI和Google Workspace从Excel/CSV生成专业报告

前置要求
  • HTTP Webhook 端点(n8n 会自动生成)
  • Google 账号和 Gmail API 凭证
  • Google Gemini API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "XyEbEQekLEetZ0za",
  "meta": {
    "instanceId": "7578372eeadee5ee5414cdf5a06141eebec63e21f295454563ddce7b1217363f",
    "templateCredsSetupCompleted": true
  },
  "name": "来自 xlsx、xls 或 csv 文件的智能报告生成器,具有基于 AI 的分析",
  "tags": [],
  "nodes": [
    {
      "id": "c092baf2-d272-4514-ae17-3f280ad8aa1a",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        160,
        96
      ],
      "webhookId": "dbcef205-4d1e-456e-9e28-2f0f291dfc43",
      "parameters": {
        "path": "generer-rapport",
        "options": {
          "ignoreBots": true,
          "allowedOrigins": "*"
        },
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2.1
    },
    {
      "id": "0cfd98f4-b0d8-40c8-99b3-241ae27ac659",
      "name": "表单提交时",
      "type": "n8n-nodes-base.formTrigger",
      "disabled": true,
      "position": [
        -192,
        -240
      ],
      "webhookId": "bb3d1e58-bd2b-42c1-b9b0-05d36a4fc557",
      "parameters": {
        "options": {},
        "formTitle": "file",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "file",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "45a26bfd-d68b-43a6-a921-3bd060cf6ce0",
      "name": "从文件提取",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        608,
        96
      ],
      "parameters": {
        "options": {},
        "operation": "xlsx",
        "binaryPropertyName": "file"
      },
      "typeVersion": 1
    },
    {
      "id": "c9cb71b7-ce40-4750-b287-942367fb5454",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1648,
        96
      ],
      "parameters": {
        "text": "=**Objectif :** Rapport d'analyse JSON complet.\n\n**Données à traiter :**\n```\n{{ $('Set data for llm').item.json.data }}\n```\n\n**Processus accéléré :**\n1. `query_data_tool` → récupération modèle\n2. `Think` → analyse structure + plan\n3. Génération JSON finale\n\n**Date :** {{ new Date().toLocaleDateString('fr-FR') }}\n**Public :** Décideurs publics\n\n**SORTIE REQUISE :** Objet JSON uniquement, format `{...}`",
        "options": {
          "systemMessage": "Tu es un agent IA expert en services publics (eau, assainissement, déchets, transport). Génère directement des analyses structurées de qualité consultant senior.\n\n## WORKFLOW \n1. **Récupération modèle** (`query_data_tool`) : \"modèle rapport services publics\"\n2. **Analyse express** (`Think`) : Structure + lacunes + plan final\n3. **Génération immédiate** : JSON complet uniquement\n\n## CRITÈRES QUALITÉ\n- Affirmations étayées par données\n- Contextualisation réglementaire/économique\n- Style professionnel précis\n- Structure cohérente du modèle de référence\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2.2
    },
    {
      "id": "91c74070-5694-4399-8b7f-e24accaf51fd",
      "name": "Google Gemini聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        1408,
        384
      ],
      "parameters": {
        "options": {
          "maxOutputTokens": 1000000
        }
      },
      "credentials": {
        "googlePalmApi": {
          "id": "89mVPG21GxPFECbN",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "12fa0c0f-5914-4293-87c6-1fc4c84fcfe6",
      "name": "为 LLM 设置数据",
      "type": "n8n-nodes-base.set",
      "position": [
        1408,
        96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "8d87ca3c-ac19-4495-a21c-e6dd3c357b64",
              "name": "data",
              "type": "string",
              "value": "={{ JSON.stringify($('Extract from File').all()) }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "047d5cdd-b127-489b-bd4c-b702389ed807",
      "name": "思考",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        1536,
        384
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "daa70af2-8a4b-4a82-88eb-9a61129ef693",
      "name": "条件分支",
      "type": "n8n-nodes-base.switch",
      "position": [
        304,
        -272
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "pdf",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "3f2744a6-2502-4e49-98b3-1a963b156dac",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.filename.split('.').pop()}}",
                    "rightValue": "pdf"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "xlsx",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "99fe1dbc-409c-4249-b76b-e16e19214f9e",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.filename.split('.').pop()}}",
                    "rightValue": "xlsx"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "docx",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6f0aba8b-2201-4804-9e6a-71eec33ad07f",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.filename.split('.').pop()}}",
                    "rightValue": "docx"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "pptx",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "9b67b06a-5db8-4e54-8670-8e3de6218417",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "pptx",
                    "rightValue": ""
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "92f0dfaa-3425-4005-b1db-57649e89ed1b",
      "name": "解析和清理 AI 响应",
      "type": "n8n-nodes-base.code",
      "position": [
        2496,
        80
      ],
      "parameters": {
        "jsCode": "// Ce script prend la sortie texte brute de l'Agent IA,\n// la nettoie, et la transforme en un objet JSON valide.\n\n// La sortie de l'Agent IA (en mode String) est dans la propriété 'output'.\nconst rawText = $input.item.json.output;\n\n// Vérification de robustesse : s'assurer que rawText existe avant de le traiter.\nif (typeof rawText !== 'string' || rawText.trim() === '') {\n  // Si rawText n'est pas une chaîne de caractères ou est vide, l'Agent IA a probablement échoué.\n  console.error(\"L'entrée de l'Agent IA est manquante ou n'est pas une chaîne de caractères.\", $input.item.json);\n  throw new Error(\"La sortie de l'Agent IA est vide ou invalide. Vérifiez l'exécution du nœud 'AI Agent'.\");\n}\n\n// Étape 1: Nettoyer le texte. On enlève les blocs de code markdown (```json ... ```) que l'IA ajoute souvent.\nlet cleanedText = rawText.replace(/^```json\\s*/, '').replace(/```$/, '');\n\n// Étape 2: Trouver le début et la fin de l'objet JSON pour enlever tout texte superflu.\nconst firstBracket = cleanedText.indexOf('{');\nconst lastBracket = cleanedText.lastIndexOf('}');\n\nif (firstBracket === -1 || lastBracket === -1) {\n  throw new Error(\"La réponse de l'IA ne contient pas de JSON valide (accolades manquantes).\");\n}\ncleanedText = cleanedText.substring(firstBracket, lastBracket + 1);\n\ntry {\n  // Étape 3: Tenter de parser le texte nettoyé en objet JSON.\n  const jsonData = JSON.parse(cleanedText);\n  // Retourner l'objet JSON propre pour le nœud suivant.\n  return { json: jsonData };\n} catch (error) {\n  // Si le parsing échoue, enregistrer les détails pour le débogage.\n  console.error(\"Erreur de parsing JSON:\", error);\n  throw new Error(`Impossible de parser la réponse de l'IA. Réponse brute nettoyée: ${cleanedText}`);\n}\n"
      },
      "typeVersion": 2
    },
    {
      "id": "e64779ec-59fb-46d4-8e72-b3b0ff369f82",
      "name": "聚合数据",
      "type": "n8n-nodes-base.code",
      "position": [
        1168,
        96
      ],
      "parameters": {
        "jsCode": "// Ce script récupère tous les items (lignes) du noeud précédent.\nconst allItems = $input.all();\n\n// On extrait la partie 'json' de chaque item pour ne garder que les données.\nconst jsonData = allItems.map(item => item.json);\n\n// On crée un objet de sortie unique qui contient toutes les données\n// converties en une chaîne de texte JSON.\nconst output = {\n  data: JSON.stringify(jsonData)\n};\n\n// On retourne ce nouvel objet. Le workflow continuera avec un seul item.\nreturn { json: output };"
      },
      "typeVersion": 2
    },
    {
      "id": "1b83ee5d-d015-49dc-b79e-4084464b56e7",
      "name": "条件判断1",
      "type": "n8n-nodes-base.if",
      "position": [
        2208,
        96
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5f70e4b4-744e-429c-b808-e5980b3068e9",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "02a87a70-de7e-4dca-a202-ac1979a9b161",
      "name": "等待2",
      "type": "n8n-nodes-base.wait",
      "position": [
        2288,
        432
      ],
      "webhookId": "396d9529-9a8e-4d1d-a51d-d435c318d369",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "adaf5f63-3a17-4e82-8a83-068f32ced066",
      "name": "聚合",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        928,
        96
      ],
      "parameters": {
        "options": {},
        "aggregate": "aggregateAllItemData"
      },
      "typeVersion": 1
    },
    {
      "id": "0686fbfd-63a2-4fd0-8fa7-19c65fcf8784",
      "name": "调用将 pdf 数据转换为 markdown",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        656,
        -224
      ],
      "parameters": {
        "options": {},
        "workflowId": {
          "__rl": true,
          "mode": "list",
          "value": "PAB8VMzM4HcZLqrm"
        },
        "workflowInputs": {
          "value": {},
          "schema": [],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": true
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "283d2024-33b0-45a9-b34f-882aae20d211",
      "name": "响应 Webhook",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        3504,
        96
      ],
      "parameters": {
        "options": {},
        "respondWith": "text",
        "responseBody": "={{ $json.output }}"
      },
      "typeVersion": 1.4
    },
    {
      "id": "81acccc0-7171-4af2-9a6d-705c52efbb58",
      "name": "思考1",
      "type": "@n8n/n8n-nodes-langchain.toolThink",
      "position": [
        2864,
        304
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "29745f55-a827-48d5-9f35-7ffb268c152f",
      "name": "条件判断",
      "type": "n8n-nodes-base.if",
      "position": [
        3104,
        80
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5f70e4b4-744e-429c-b808-e5980b3068e9",
              "operator": {
                "type": "string",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $json.output }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "e24f16e8-83ed-4659-ad09-c83bd25f8cc9",
      "name": "等待",
      "type": "n8n-nodes-base.wait",
      "position": [
        3616,
        528
      ],
      "webhookId": "396d9529-9a8e-4d1d-a51d-d435c318d369",
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "64100db0-dc2e-412c-8b5b-ba80b4ca5b69",
      "name": "在 Google Docs 中创建文档",
      "type": "n8n-nodes-base.googleDocsTool",
      "position": [
        3408,
        784
      ],
      "parameters": {
        "title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', ``, 'string') }}",
        "folderId": "default"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "osBJI4KIPRu07ngs",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "e8733e43-1b5a-45fc-bf01-7d724e056e9e",
      "name": "默认数据加载器",
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "position": [
        784,
        752
      ],
      "parameters": {
        "options": {},
        "dataType": "binary"
      },
      "typeVersion": 1.1
    },
    {
      "id": "d89e53ba-7053-4f57-bad9-e606309bb718",
      "name": "插入数据到存储",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        704,
        544
      ],
      "parameters": {
        "mode": "insert",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key",
          "cachedResultName": "vector_store_key"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "83721b71-48b1-4480-9ad5-00116e5f11ce",
      "name": "嵌入 Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        640,
        752
      ],
      "parameters": {},
      "credentials": {
        "googlePalmApi": {
          "id": "89mVPG21GxPFECbN",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "71720028-f795-4ff4-94b0-220bed8db36e",
      "name": "Google Gemini 聊天模型2",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2576,
        544
      ],
      "parameters": {
        "options": {
          "maxOutputTokens": 10000
        },
        "modelName": "models/gemini-2.5-pro"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "89mVPG21GxPFECbN",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "8cbc4307-3842-42df-98ea-ea292d0969f1",
      "name": "查询数据工具1",
      "type": "@n8n/n8n-nodes-langchain.vectorStoreInMemory",
      "position": [
        1776,
        368
      ],
      "parameters": {
        "mode": "retrieve-as-tool",
        "toolName": "knowledge_base",
        "memoryKey": {
          "__rl": true,
          "mode": "list",
          "value": "vector_store_key"
        },
        "toolDescription": "Use this knowledge base to answer questions from the user"
      },
      "typeVersion": 1.2
    },
    {
      "id": "63740075-f0a9-488c-b5b9-baddad0d5ea0",
      "name": "嵌入 Google Gemini2",
      "type": "@n8n/n8n-nodes-langchain.embeddingsGoogleGemini",
      "position": [
        1808,
        480
      ],
      "parameters": {},
      "credentials": {
        "googlePalmApi": {
          "id": "89mVPG21GxPFECbN",
          "name": "Google Gemini(PaLM) Api account"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a41fc482-7614-4675-9812-691ef5a57670",
      "name": "在 Google Docs 中获取文档",
      "type": "n8n-nodes-base.googleDocsTool",
      "position": [
        3552,
        752
      ],
      "parameters": {
        "operation": "get",
        "documentURL": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Doc_ID_or_URL', ``, 'string') }}"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "osBJI4KIPRu07ngs",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "19f610f1-e535-45bb-95af-ecd6fb37de82",
      "name": "在 Google Docs 中更新文档",
      "type": "n8n-nodes-base.googleDocsTool",
      "position": [
        3296,
        784
      ],
      "parameters": {
        "actionsUi": {
          "actionFields": [
            {
              "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('actionFields0_Text', ``, 'string') }}",
              "action": "insert"
            }
          ]
        },
        "operation": "update",
        "documentURL": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Doc_ID_or_URL', ``, 'string') }}"
      },
      "credentials": {
        "googleDocsOAuth2Api": {
          "id": "osBJI4KIPRu07ngs",
          "name": "Google Docs account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ca4023c5-1827-4327-bd00-95845aed6939",
      "name": "数据库",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        544,
        544
      ],
      "webhookId": "82848bc4-5ea2-4e5a-8bb6-3c09b94a8c5d",
      "parameters": {
        "options": {},
        "formTitle": "Upload your data to test RAG",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "Upload your file(s)",
              "requiredField": true,
              "acceptFileTypes": ".pdf, .csv"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "4ac52a39-600b-4851-8ee2-b12509031fa6",
      "name": "代码",
      "type": "n8n-nodes-base.code",
      "position": [
        96,
        -240
      ],
      "parameters": {
        "jsCode": "// Dans un nœud Code\nconst binaryData = $node[\"On form submission\"].binary;\nlet filename = \"\";\n\nif (binaryData && Object.keys(binaryData).length > 0) {\n  const firstKey = Object.keys(binaryData)[0];\n  const fileData = binaryData[firstKey];\n  \n  // Le nom peut être dans fileName ou filename\n  filename = fileData.fileName || fileData.filename || \"fichier_inconnu\";\n}\n\nreturn [{ json: { filename } }];"
      },
      "typeVersion": 2
    },
    {
      "id": "a56ab4b1-a29c-455e-9668-582bf6792fcf",
      "name": "编辑字段",
      "type": "n8n-nodes-base.set",
      "position": [
        2000,
        96
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e2579242-2cf7-45c0-957b-6eb3ee97ef23",
              "name": "output",
              "type": "string",
              "value": "={{ $json.output }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "acea6026-2faf-4e30-b3ce-48386d4d5573",
      "name": "AI 代理工具1",
      "type": "@n8n/n8n-nodes-langchain.agentTool",
      "position": [
        3072,
        288
      ],
      "parameters": {
        "text": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Prompt__User_Message_', ``, 'string') }}",
        "options": {
          "systemMessage": "### Phase 1: Analyse Immédiate du Rapport \n**Extraire du rapport reçu :**\n- Titre principal \n- Structure des sections (I, II, III...)\n- Données tabulaires à formater\n- Listes et éléments de mise en forme\n\n### Phase 2: Création Google Docs TEXTUELLE \n**IMPORTANT : Créer du TEXTE formaté, PAS du JSON**\n\n**Structure obligatoire à générer :**\n\n```\nTITRE PRINCIPAL\n[Style : Titre - gras, centré, taille 18]\n\nTable des matières\n[Insérer automatiquement via Google Docs]\n\nI. PREMIÈRE SECTION\n[Style : Titre 1 - gras, taille 16]\n\nParagraphe d'introduction expliquant le contexte et les objectifs de cette section avec des phrases complètes et professionnelles.\n\nA. Sous-section principale\n[Style : Titre 2 - gras, taille 14]\n\nContenu détaillé avec analyse contextuelle. Les données doivent être présentées de manière narrative et professionnelle.\n\nTABLEAU : [Titre du tableau]\n| Colonne 1        | Colonne 2        |\n|------------------|------------------|\n| Données ligne 1  | Valeurs ligne 1  |\n| Données ligne 2  | Valeurs ligne 2  |\n\nB. Autre sous-section\n[Contenu structuré similaire]\n\nII. DEUXIÈME SECTION\n[Même structure hiérarchique]\n\nSYNTHÈSE ET RECOMMANDATIONS\n[Section finale avec conclusions]\n```\n\n### Phase 3: Commandes Google Docs UNIQUEMENT pour Formatage\n**Utiliser les outils Google Docs UNIQUEMENT pour :**\n1. Appliquer les styles (Titre, Titre 1, Titre 2)\n2. Formater les tableaux avec bordures\n3. Appliquer gras/italique aux éléments importants\n4. Insérer la table des matières\n\n**INTERDICTIONS ABSOLUES :**\n- ❌ JAMAIS de JSON visible dans le document\n- ❌ JAMAIS de commandes brutes type \"insertText\"\n- ❌ JAMAIS de syntaxe technique dans le contenu final\n\n### Phase 4: Vérification et Génération Lien\n**Contrôles avant finalisation :**\n✓ Document lisible en français\n✓ Structure claire et hiérarchique  \n✓ Tableaux correctement formatés\n✓ Aucun code technique visible\n✓ Mise en forme professionnelle appliquée\n\n**Générer le lien de téléchargement .docx**\n\n## TEMPLATE DE TRANSFORMATION\n\n**Transformer :**\n```json\n\"insertText\": {\"text\": \"Analyse Financière\"}\n```\n\n**En :**\n```\nAnalyse Financière\n```\n\n**Puis appliquer le formatage Google Docs pour le style Titre 1**\n\n## RÈGLES DE CONTENU\n\n**Pour chaque section du rapport :**\n1. **Titre clair** en français\n2. **Introduction contextuelle** (2-3 phrases)  \n3. **Développement structuré** avec données intégrées naturellement\n4. **Tableaux formatés** pour données chiffrées\n5. **Conclusion/transition** vers section suivante\n\n**Style rédactionnel :**\n- Phrases complètes et professionnelles\n- Terminologie adaptée aux décideurs publics\n- Analyses contextuelles des données\n- Pas de jargon technique visible\n\n## SORTIE FINALE\n**UNIQUEMENT le lien de téléchargement :**\n```\nhttps://docs.google.com/document/d/[ID]/export?format=docx\n```\n\n**Le document téléchargé doit être :**\n- Entièrement lisible en français\n- Structuré professionnellement  \n- Sans aucun code technique\n- Prêt pour présentation aux décideurs"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "bd41c4d1-d049-4e33-91c8-b1f11a8e9dc9",
      "name": "AI Agent1",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2736,
        80
      ],
      "parameters": {
        "text": "=Traitement JSON → Rapport Google Docs → Envoi automatique.\n\n**ÉTAPES OBLIGATOIRES :**\n1. **'Think'** : Analyse structure JSON (1 min)\n2. **Génération** : Rapport Google Docs formaté (3 min) \n3. **'AI Agent Tool'** : Envoi automatique du rapport généré (OBLIGATOIRE)\n4. **Sortie** : Lien de téléchargement uniquement\n\n**Données JSON à traiter :**\n```json\n{{ JSON.stringify($('Parse and Clean AI Response').item.json) }}\n```\n\n**Action immédiate requise - Pas d'explications intermédiaires.**",
        "options": {
          "systemMessage": "## Mission\nAgent de transformation JSON vers rapport Google Docs professionnel avec traitement automatisé obligatoire.\n\n## Workflow Streamliné (3 Phases)\n\n### Phase 1: Analyse Express (2 min max)\n**Utiliser l'outil 'Think' pour analyser rapidement :**\n- Structure JSON : identifier types de données (tableaux, listes, valeurs clés)\n- Architecture cible : définir sections principales uniquement\n- Éléments critiques : repérer données quantitatives pour tableaux\n\n### Phase 2: Génération Rapport (5 min max)\n**Format Google Docs STRICT :**\n1. **Titre principal** (style Titre)\n2. **Sections principales** (Titre 1) - Maximum 5 sections\n3. **Tableaux** pour toutes données structurées (insertTable)\n4. **Paragraphes** synthétiques en texte normal\n5. **Listes** via commandes Google Docs uniquement\n\n**Templates de formatage rapide :**\n```\nTitres: insertText + updateTextStyle (HEADING_1/2/3)\nTableaux: insertTable + formatage cellules\nTexte: insertText (NORMAL_TEXT)\nGras: updateTextStyle (BOLD: true)\n```\n\n### Phase 3: Envoi Automatique (OBLIGATOIRE)\n**IMMÉDIATEMENT après génération du rapport :**\n1. Utiliser 'AI Agent Tool' avec le rapport complet comme user_message\n2. Récupérer le lien de téléchargement\n3. Retourner UNIQUEMENT le lien (pas d'explications)\n\n## Règles d'Efficacité\n- **NO MARKDOWN/HTML** dans le document final\n- **Tableaux systematiques** pour données structurées\n- **Synthèse directe** : pas d'analyse détaillée, action immédiate\n- **Format professionnel** mais optimisé pour la vitesse\n\n## Points Critiques\n1. Utiliser 'Think' pour planification rapide\n2. Générer rapport directement compatible Google Docs\n3. Envoi AUTOMATIQUE via 'AI Agent Tool' - JAMAIS d'oubli\n4. Retour UNIQUEMENT du lien final\n"
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "89aae5d1-25b2-4514-94ee-c29701766260",
      "name": "在 Google Slides 中创建演示文稿",
      "type": "n8n-nodes-base.googleSlidesTool",
      "position": [
        2976,
        768
      ],
      "parameters": {
        "title": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Title', ``, 'string') }}"
      },
      "credentials": {
        "googleSlidesOAuth2Api": {
          "id": "YxA3lFXuzHxrYXyh",
          "name": "Google Slides account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "4db12769-c5ff-448e-9683-b297971f53ff",
      "name": "在 Gmail 中发送消息",
      "type": "n8n-nodes-base.gmailTool",
      "position": [
        3152,
        880
      ],
      "webhookId": "6ac45ca1-53ad-404d-b0df-72e5cf95f648",
      "parameters": {
        "sendTo": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('To', ``, 'string') }}",
        "message": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Message', ``, 'string') }}",
        "options": {},
        "subject": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Subject', ``, 'string') }}"
      },
      "credentials": {
        "gmailOAuth2": {
          "id": "bCMxMEI1mYg8Dfji",
          "name": "Gmail account"
        }
      },
      "typeVersion": 2.1
    },
    {
      "id": "11fdf13f-479e-472d-9325-afddaa28d450",
      "name": "在 Google Slides 中替换演示文稿中的文本",
      "type": "n8n-nodes-base.googleSlidesTool",
      "position": [
        2816,
        768
      ],
      "parameters": {
        "options": {},
        "operation": "replaceText",
        "presentationId": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Presentation_ID', ``, 'string') }}"
      },
      "credentials": {
        "googleSlidesOAuth2Api": {
          "id": "YxA3lFXuzHxrYXyh",
          "name": "Google Slides account"
        }
      },
      "typeVersion": 2
    }
  ],
  "active": true,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "96dcf1a7-26ca-4b12-a1b4-1e63a5ec0bf1",
  "connections": {
    "DB": {
      "main": [
        [
          {
            "node": "Insert Data to Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If1": {
      "main": [
        [
          {
            "node": "Parse and Clean AI Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Think": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Wait2": {
      "main": [
        [
          {
            "node": "Set data for llm",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "Call Transform pdf data to markdown",
            "type": "main",
            "index": 0
          }
        ],
        [],
        [],
        []
      ]
    },
    "Think1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Webhook": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent1": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate": {
      "main": [
        [
          {
            "node": "Aggregate Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "If1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent Tool1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate Data": {
      "main": [
        [
          {
            "node": "Set data for llm",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Query Data Tool1": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Set data for llm": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Respond to Webhook": {
      "main": [
        [
          {
            "node": "Respond to Webhook",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Insert Data to Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Send a message in Gmail": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Tool1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini": {
      "ai_embedding": [
        [
          {
            "node": "Insert Data to Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Embeddings Google Gemini2": {
      "ai_embedding": [
        [
          {
            "node": "Query Data Tool1",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent1",
            "type": "ai_languageModel",
            "index": 0
          },
          {
            "node": "AI Agent Tool1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Parse and Clean AI Response": {
      "main": [
        [
          {
            "node": "AI Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get a document in Google Docs": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Tool1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create a document in Google Docs": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Tool1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Update a document in Google Docs": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Tool1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Call Transform pdf data to markdown": {
      "main": [
        [
          {
            "node": "Aggregate",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a presentation in Google Slides": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Tool1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Replace text in a presentation in Google Slides": {
      "ai_tool": [
        [
          {
            "node": "AI Agent Tool1",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 文档提取, 多模态 AI

需要付费吗?

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

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

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

外部链接
在 n8n.io 查看

分享此工作流