Débutant en analyse de données : fusion, filtrage et résumé dans Google Sheets avec GPT-4o

Avancé

Ceci est unDocument Extraction, AI Summarizationworkflow d'automatisation du domainecontenant 21 nœuds.Utilise principalement des nœuds comme If, Set, Code, Merge, Filter. Analyse de données pour débutants : fusion, filtrage et résumé dans Google Sheets avec GPT-4o

Prérequis
  • Informations d'identification Google Sheets API
  • Clé API OpenAI
Aperçu du workflow
Visualisation des connexions entre les nœuds, avec support du zoom et du déplacement
Exporter le workflow
Copiez la configuration JSON suivante dans n8n pour importer et utiliser ce workflow
{
  "meta": {
    "instanceId": "efb474b59b0341d7791932605bd9ff04a6c7ed9941fdd53dc4a2e4b99a6f9439",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "a241764c-eb51-4d7a-b5d4-3aa517a9195f",
      "name": "Google Sheets1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -160,
        280
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": 173686600,
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit#gid=173686600",
          "cachedResultName": "Sheet2"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit?usp=drivesdk",
          "cachedResultName": "Sample Marketing Data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "WsgMg14OYooIdvn7",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "d7b9ee1a-f87d-42f6-b480-8ee687612f33",
      "name": "Filtrer",
      "type": "n8n-nodes-base.filter",
      "position": [
        340,
        120
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "65acf956-5912-4070-8896-923b74548a5e",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.Clicks }}",
              "rightValue": 5
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "872dd275-ca9a-4d30-8ac1-e1e921f5e6fd",
      "name": "Convertir les noms de tableaux et colonnes en texte unique pour l'agent",
      "type": "n8n-nodes-base.code",
      "position": [
        1380,
        280
      ],
      "parameters": {
        "jsCode": "return [\n  {\n    json: {\n      text: items.map(item => JSON.stringify(item.json)).join('\\n'),\n    },\n  },\n];\n"
      },
      "typeVersion": 2
    },
    {
      "id": "4b8595d1-d975-49f6-bff0-265aef52042f",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1620,
        500
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "ghJTvay8CvwXDsXz",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "c83d8a13-b2da-42f5-b137-763fa06e22e4",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1800,
        500
      ],
      "parameters": {
        "jsonSchemaExample": "{\n\t\"paragraph\": \"full paragraph\"\n}"
      },
      "typeVersion": 1.2
    },
    {
      "id": "c1ad3e75-1964-4f3b-b60c-a9531f8770f7",
      "name": "Note adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -200
      ],
      "parameters": {
        "width": 700,
        "height": 880,
        "content": "### 📌 Merge Multiple Datasets\n\nPull two Google Sheets:\n\n- **Marketing data** (performance metrics)  \n- **Leader assignment** (who manages each channel)\n\nThen merge the two sheets based on the **Channel** field.\n\n---\n"
      },
      "typeVersion": 1
    },
    {
      "id": "9de427fa-c2e0-4de0-8e7b-35d4566f3d6e",
      "name": "Note adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        280,
        -200
      ],
      "parameters": {
        "color": 5,
        "width": 380,
        "height": 880,
        "content": "\n### 📌 Filter and If Steps\n\n**Step 1:** Filter records with **Clicks ≥ 5**  \n**Step 2:** Branch logic:\n\n- If **Spend ≥ 350** → `\"Great\"` outcome  \n- Else → `\"Poor\"` outcome\n\n---"
      },
      "typeVersion": 1
    },
    {
      "id": "8aa28836-07db-42f7-b2da-0b2e656e92c7",
      "name": "Note adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -200
      ],
      "parameters": {
        "color": 3,
        "width": 380,
        "height": 880,
        "content": "### 📌 Summarize and Set Steps\n\nFor each branch (**Great** / **Poor**):\n\n- Count the number of rows per **Leader**  \n- Assign outcome labels  \n- Prepare fields like `Leader`, `Outcome`, and `Day count`\n\n---"
      },
      "typeVersion": 1
    },
    {
      "id": "1fb89d3c-a10e-490d-998a-42436a1d05d0",
      "name": "Note adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1100,
        -200
      ],
      "parameters": {
        "color": 2,
        "width": 860,
        "height": 880,
        "content": "### 📌 Analyze Results with an AI Agent\n\n- Merge both sets of labeled outcomes  \n- Convert to a readable text format  \n- Use an **AI Agent** to summarize and compare performance of leaders  \n- Output a **paragraph** that identifies the **best** and **worst** performers and **why**"
      },
      "typeVersion": 1
    },
    {
      "id": "02854b46-8baf-438e-b110-92ce4e96dd6b",
      "name": "Exemple de Données Marketing",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -160,
        80
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/edit?usp=drivesdk",
          "cachedResultName": "Sample Marketing Data"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "WsgMg14OYooIdvn7",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "cf5b6397-fe1a-46db-928a-5903507ef424",
      "name": "Démarrer le Workflow",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -380,
        180
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "58039c62-8b23-4114-9e86-5502c82719ee",
      "name": "Fusionner sur le Champ Channel",
      "type": "n8n-nodes-base.merge",
      "position": [
        60,
        180
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "fieldsToMatchString": "Channel"
      },
      "typeVersion": 3.2
    },
    {
      "id": "7ed757ca-05b7-41af-9f70-f88b9aba4981",
      "name": "Vérifier si dépense > 350$",
      "type": "n8n-nodes-base.if",
      "position": [
        460,
        340
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "c0cba05b-63ba-420e-851a-caf2bf9b9914",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json['Spend ($)'] }}",
              "rightValue": 350
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "73aeb996-58d7-4492-a948-bc6f9f92cb46",
      "name": "Compter les mauvais jours",
      "type": "n8n-nodes-base.summarize",
      "position": [
        740,
        100
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "Leader",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "row_number"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "af21446e-d779-4937-bee4-d650dccd8f32",
      "name": "Compter les bons jours",
      "type": "n8n-nodes-base.summarize",
      "position": [
        760,
        300
      ],
      "parameters": {
        "options": {},
        "fieldsToSplitBy": "Leader",
        "fieldsToSummarize": {
          "values": [
            {
              "field": "row_number"
            }
          ]
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "9b6bb3eb-aae2-4317-8551-78fb81312765",
      "name": "Organiser les champs en tableau",
      "type": "n8n-nodes-base.set",
      "position": [
        920,
        120
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "e2f52c05-13a5-4692-bbea-87642535145e",
              "name": "Outcome",
              "type": "string",
              "value": "Poor"
            },
            {
              "id": "8c353e0a-409f-4cff-a1b9-17259cc3a1dd",
              "name": "# of Days",
              "type": "number",
              "value": "={{ $json.count_row_number }}"
            },
            {
              "id": "82d2f8dd-54b8-42c8-b502-6ae1fc76e1fe",
              "name": "Leader",
              "type": "string",
              "value": "={{ $json.Leader }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "b5780191-2068-4595-b18c-16626003145d",
      "name": "Organiser les secondes données en tableau",
      "type": "n8n-nodes-base.set",
      "position": [
        920,
        320
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "f3f79a06-acb9-4b89-a7ab-438358b4395e",
              "name": "Outcome",
              "type": "string",
              "value": "Great"
            },
            {
              "id": "e79913fa-a2ec-459c-a00d-df23bb1a2a25",
              "name": "# of Days",
              "type": "number",
              "value": "={{ $json.count_row_number }}"
            },
            {
              "id": "a6b563e3-0776-4916-a9f3-05d38a67330a",
              "name": "Leader",
              "type": "string",
              "value": "={{ $json.Leader }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "097dc227-3999-427c-9900-008845b00131",
      "name": "Fusionner les sources de données",
      "type": "n8n-nodes-base.merge",
      "position": [
        1180,
        220
      ],
      "parameters": {},
      "typeVersion": 3.2
    },
    {
      "id": "1ec5183b-be3f-447a-b312-56420ac5c706",
      "name": "Agent IA - Résumer la Performance du Leader",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1600,
        180
      ],
      "parameters": {
        "text": "={{ $json.text }}",
        "options": {
          "systemMessage": "You are given a list of outcomes by leader. write a summary of the outcomes and identify who is doing the best and worst, and why. \n\noutput as one paragraph. \n\nOutput like this. \n\n{\n\t\"paragraph\": \"full paragraph\"\n}"
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "typeVersion": 2
    },
    {
      "id": "0a53ca1a-53f0-4d68-b70f-e5fff251af5f",
      "name": "Note adhésive4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -400
      ],
      "parameters": {
        "color": 4,
        "width": 1100,
        "content": "### 📌 Setup Instructions\n\nBefore running the workflow:\n\n1. **Copy the sample Google Sheet**  \n   [Click here to copy the Google Sheet](https://docs.google.com/spreadsheets/d/19aUQYZq02qHsCelO4eeV4sx_MTJJupC5qe0gDLQBtRA/copy)\n\n2. **Connect Google Sheets API**  \n   - In n8n, go to **Credentials** and create a **Google Sheets OAuth2** credential.\n   - Make sure to authorize access to the copied spreadsheet.\n\n3. **Add your OpenAI API Key**  \n   - In the **AI Agent** step, connect your **OpenAI credential** using your API key.\n\n---"
      },
      "typeVersion": 1
    },
    {
      "id": "4dffd2eb-9a06-4103-97a5-47aeccdca95c",
      "name": "Note adhésive5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        680,
        -400
      ],
      "parameters": {
        "color": 2,
        "width": 1280,
        "content": "### 👋 Questions or Feedback?\nFeel free to reach out — I’m happy to help!\n**Robert Breen**  \nFounder, Ynteractive  \n🌐 [ynteractive.com](https://ynteractive.com)  \n📧 robert@ynteractive.com  \n🔗 [LinkedIn: linkedin.com/in/robertbreen](https://www.linkedin.com/in/robertbreen)"
      },
      "typeVersion": 1
    }
  ],
  "pinData": {},
  "connections": {
    "d7b9ee1a-f87d-42f6-b480-8ee687612f33": {
      "main": [
        [
          {
            "node": "7ed757ca-05b7-41af-9f70-f88b9aba4981",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "73aeb996-58d7-4492-a948-bc6f9f92cb46": {
      "main": [
        [
          {
            "node": "9b6bb3eb-aae2-4317-8551-78fb81312765",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a241764c-eb51-4d7a-b5d4-3aa517a9195f": {
      "main": [
        [
          {
            "node": "58039c62-8b23-4114-9e86-5502c82719ee",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "cf5b6397-fe1a-46db-928a-5903507ef424": {
      "main": [
        [
          {
            "node": "02854b46-8baf-438e-b110-92ce4e96dd6b",
            "type": "main",
            "index": 0
          },
          {
            "node": "a241764c-eb51-4d7a-b5d4-3aa517a9195f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "af21446e-d779-4937-bee4-d650dccd8f32": {
      "main": [
        [
          {
            "node": "b5780191-2068-4595-b18c-16626003145d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4b8595d1-d975-49f6-bff0-265aef52042f": {
      "ai_languageModel": [
        [
          {
            "node": "1ec5183b-be3f-447a-b312-56420ac5c706",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "02854b46-8baf-438e-b110-92ce4e96dd6b": {
      "main": [
        [
          {
            "node": "58039c62-8b23-4114-9e86-5502c82719ee",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "58039c62-8b23-4114-9e86-5502c82719ee": {
      "main": [
        [
          {
            "node": "d7b9ee1a-f87d-42f6-b480-8ee687612f33",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7ed757ca-05b7-41af-9f70-f88b9aba4981": {
      "main": [
        [
          {
            "node": "73aeb996-58d7-4492-a948-bc6f9f92cb46",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "af21446e-d779-4937-bee4-d650dccd8f32",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "c83d8a13-b2da-42f5-b137-763fa06e22e4": {
      "ai_outputParser": [
        [
          {
            "node": "1ec5183b-be3f-447a-b312-56420ac5c706",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "9b6bb3eb-aae2-4317-8551-78fb81312765": {
      "main": [
        [
          {
            "node": "097dc227-3999-427c-9900-008845b00131",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "097dc227-3999-427c-9900-008845b00131": {
      "main": [
        [
          {
            "node": "872dd275-ca9a-4d30-8ac1-e1e921f5e6fd",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b5780191-2068-4595-b18c-16626003145d": {
      "main": [
        [
          {
            "node": "097dc227-3999-427c-9900-008845b00131",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "1ec5183b-be3f-447a-b312-56420ac5c706": {
      "main": [
        []
      ]
    },
    "872dd275-ca9a-4d30-8ac1-e1e921f5e6fd": {
      "main": [
        [
          {
            "node": "1ec5183b-be3f-447a-b312-56420ac5c706",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Foire aux questions

Comment utiliser ce workflow ?

Copiez le code de configuration JSON ci-dessus, créez un nouveau workflow dans votre instance n8n et sélectionnez "Importer depuis le JSON", collez la configuration et modifiez les paramètres d'authentification selon vos besoins.

Dans quelles scénarios ce workflow est-il adapté ?

Avancé - Extraction de documents, Résumé IA

Est-ce payant ?

Ce workflow est entièrement gratuit et peut être utilisé directement. Veuillez noter que les services tiers utilisés dans le workflow (comme l'API OpenAI) peuvent nécessiter un paiement de votre part.

Informations sur le workflow
Niveau de difficulté
Avancé
Nombre de nœuds21
Catégorie2
Types de nœuds12
Description de la difficulté

Adapté aux utilisateurs avancés, avec des workflows complexes contenant 16+ nœuds

Auteur
Robert Breen

Robert Breen

@rbreen

Professional services consultant with over 10 years of experience solving complex business problems across industries. I specialize in n8n and process automation—designing custom workflows that integrate tools like Google Calendar, Airtable, GPT, and internal systems. Whether you need to automate scheduling, sync data, or streamline operations, I build solutions that save time and drive results.

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34