Extraction de données à partir de factures via OCR, Gemini AI et Airtable

Avancé

Ceci est unAI Summarization, Multimodal AIworkflow d'automatisation du domainecontenant 18 nœuds.Utilise principalement des nœuds comme If, Switch, Telegram, Aggregate, AirtableTool. Extraire les données de factures avec OCR, Gemini AI et Airtable

Prérequis
  • Token Bot Telegram
  • Clé API Airtable
  • Clé API Google Gemini
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": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a",
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "b7d49dfb-9e34-4ef3-8533-938a5dc1bbcb",
      "name": "Déclencheur Fichier Local",
      "type": "n8n-nodes-base.localFileTrigger",
      "position": [
        -2928,
        368
      ],
      "parameters": {
        "path": "/image-output/ocr",
        "events": [
          "add"
        ],
        "options": {
          "usePolling": true,
          "awaitWriteFinish": true
        },
        "triggerOn": "folder"
      },
      "typeVersion": 1
    },
    {
      "id": "dda2ddaa-ff24-4694-95c8-5e3d5cfaa88d",
      "name": "Modèle de Chat Google Gemini",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        -1488,
        592
      ],
      "parameters": {
        "options": {},
        "modelName": "models/gemini-2.5-flash-preview-05-20"
      },
      "credentials": {
        "googlePalmApi": {
          "id": "DgSd8qj0VSc8QXnp",
          "name": "Google Gemini(PaLM) Api account (vinrocks.1789)"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "9c13f6b8-626a-4eb0-80ff-90b093d1948d",
      "name": "Tesseract",
      "type": "n8n-nodes-tesseractjs.tesseractNode",
      "position": [
        -2224,
        464
      ],
      "parameters": {
        "options": {
          "psm": "SINGLE_COLUMN",
          "language": "eng"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a364c562-5092-4c88-8a80-2271997dee0d",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1984,
        368
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "outputKey": "Jpg",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "6e77c197-5184-4293-9038-e4231c481df9",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $('Check File Type').item.json.fileExtension }}",
                    "rightValue": "jpg"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Pdf",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "d500e707-0f7e-4a4f-86a6-9090888dbf7e",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Check File Type').item.json.fileExtension }}",
                    "rightValue": "pdf"
                  }
                ]
              },
              "renameOutput": true
            },
            {
              "outputKey": "Png",
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "5411d519-2475-43fd-ae62-8d9f795716c8",
                    "operator": {
                      "name": "filter.operator.equals",
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $('Check File Type').item.json.fileExtension }}",
                    "rightValue": "png"
                  }
                ]
              },
              "renameOutput": true
            }
          ]
        },
        "options": {
          "allMatchingOutputs": false
        }
      },
      "typeVersion": 3.2
    },
    {
      "id": "13144779-2c29-47bd-bf46-5d58b272564c",
      "name": "Agrégat",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -1728,
        368
      ],
      "parameters": {
        "include": "allFieldsExcept",
        "options": {},
        "aggregate": "aggregateAllItemData",
        "fieldsToExclude": "confidence, filename, totalPages, pages, metadata, info"
      },
      "typeVersion": 1
    },
    {
      "id": "f264557e-3691-4c64-97a9-5ca11cf58789",
      "name": "Extraction de Page PDF",
      "type": "n8n-nodes-pdf-page-extract.pdfPageExtract",
      "position": [
        -2224,
        224
      ],
      "parameters": {
        "includeRawText": true
      },
      "typeVersion": 1
    },
    {
      "id": "4ce9888a-1534-41eb-9636-87b861e7ea79",
      "name": "Telegram",
      "type": "n8n-nodes-base.telegram",
      "position": [
        -1120,
        368
      ],
      "webhookId": "bb7bb12e-438f-4cd1-82bd-a7ffcc08b33e",
      "parameters": {
        "text": "={{ $json.output }}",
        "chatId": "8182583xxx",
        "additionalFields": {
          "appendAttribution": false
        }
      },
      "credentials": {
        "telegramApi": {
          "id": "o62WcUBZY5nNl0wr",
          "name": "Telegram account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "cab3796a-87ed-4a33-9eb6-f73f5da840cc",
      "name": "Lire Fichier",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        -2656,
        368
      ],
      "parameters": {
        "options": {
          "dataPropertyName": "data"
        },
        "fileSelector": "={{ $json.path }}"
      },
      "typeVersion": 1
    },
    {
      "id": "3bd4eb3b-c0d6-48bc-ac75-a10eaf258f39",
      "name": "Note Adhésive",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3008,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 260,
        "height": 100,
        "content": "### Ensure you are pointing the folder location in the trigger to the folder you have mounted in n8n."
      },
      "typeVersion": 1
    },
    {
      "id": "40d2b4ef-4cea-4cdd-aec2-92293c50c11f",
      "name": "Note Adhésive1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3008,
        -80
      ],
      "parameters": {
        "width": 800,
        "height": 180,
        "content": "## Features\n- ✅ Supports JPG, PNG, and PDF invoices\n- 🧠 Extracts: Invoice number, date, total, tax, subtotal, currency, vendor name, email, phone, ship-to address\n- 📤 Sends data to Airtable automatically\n- 📬 Telegram message on completion (optional)\n- 🔁 Runs automatically when files are dropped into a folder"
      },
      "typeVersion": 1
    },
    {
      "id": "55ef424c-137c-4dee-82f8-0cec6ec9b6dc",
      "name": "Note Adhésive2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2288,
        128
      ],
      "parameters": {
        "color": 7,
        "width": 220,
        "height": 80,
        "content": "### Community node:\nn8n-nodes-pdf-page-extract"
      },
      "typeVersion": 1
    },
    {
      "id": "b3b4dc66-549e-4a07-a59f-75dad99ff605",
      "name": "Note Adhésive3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        240
      ],
      "parameters": {
        "color": 7,
        "height": 100,
        "content": "### Please ensure to update your Chat ID so that the bot can send the message your DM."
      },
      "typeVersion": 1
    },
    {
      "id": "c93ffea4-940a-4249-9f82-fc3e4971f18f",
      "name": "Note Adhésive4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1232,
        624
      ],
      "parameters": {
        "color": 3,
        "width": 360,
        "height": 80,
        "content": "### If you would not like to use Airtable, you can use Google sheets as an alternative."
      },
      "typeVersion": 1
    },
    {
      "id": "1471c100-5ab0-4eb7-bd0b-2c4063f71715",
      "name": "Note Adhésive5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2288,
        624
      ],
      "parameters": {
        "color": 3,
        "width": 200,
        "height": 80,
        "content": "### Community node:\nn8n-nodes-tesseractjs"
      },
      "typeVersion": 1
    },
    {
      "id": "8b019576-37ff-4c16-b679-fb00d132243f",
      "name": "Note Adhésive6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -3008,
        768
      ],
      "parameters": {
        "width": 740,
        "height": 80,
        "content": "## If you need any help in setting up with the workflow, please feel free to contact me @ vinaysingh.b@outlook.in"
      },
      "typeVersion": 1
    },
    {
      "id": "28d2c502-3104-4d18-ab1c-2fd14495a3cf",
      "name": "Extraire Données Facture (Gemini)",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -1488,
        368
      ],
      "parameters": {
        "text": "={{ $json.data }}",
        "options": {
          "systemMessage": "=<TASK>\nProcess received \"{{ $json.data[0].text }}\" and update individual fields in the Airtable tool, like for example\n\nInvoice Number,\nInvoice date if available (if available), Always convert the date into format : '2025-06-21',\nInvoice SubTotal amount (if available),\nInvoice tax (if available),\nInvoice Total,\nCurrency,\nVendor Name,\nEmail address of the vendor,\nPhone number(ignore if FAX number is available),\nShip to address\n</TASK>\n\n<Telegram_Response>\nPlease reply in the below format:\n\nInvoice details has been updated successfully.\nInvoice: <>\nInvoice date: <>\nInvoice SubTotal: <>\nInvoice tax: <>\nInvoice Total: <>\nCurrency: <>\nVendor: <>\nEmail address: <>\nPhone number: <>\nShip to address: <>\n</Telegram_Response>"
        },
        "promptType": "define"
      },
      "typeVersion": 2
    },
    {
      "id": "d702cf55-1761-4b31-9e8e-e8ceb1da9171",
      "name": "Vérifier Type de Fichier",
      "type": "n8n-nodes-base.if",
      "position": [
        -2480,
        368
      ],
      "parameters": {
        "options": {
          "ignoreCase": true
        },
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": false,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "7fbe81a0-6a37-4e9b-af8a-b692a8151507",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ $json.fileType }}",
              "rightValue": "pdf"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "880b0f62-07e1-495e-b36a-948c5eb70c27",
      "name": "Sauvegarder vers Airtable",
      "type": "n8n-nodes-base.airtableTool",
      "position": [
        -1344,
        592
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appAl4CX1mypNyRJv",
          "cachedResultUrl": "https://airtable.com/appAl4CX1mypNyRJv",
          "cachedResultName": "Personal Project Tracker"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tblBr2vL7frtavGn8",
          "cachedResultUrl": "https://airtable.com/appAl4CX1mypNyRJv/tblBr2vL7frtavGn8",
          "cachedResultName": "OCR"
        },
        "columns": {
          "value": {
            "Currency": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Currency', ``, 'string') }}",
            "Invoice tax": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Invoice_tax', ``, 'number') }}",
            "Vendor name": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Vendor_name', ``, 'string') }}",
            "Invoice date": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Invoice_date', ``, 'string') }}",
            "Phone number": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Phone_number', ``, 'string') }}",
            "Email address": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Email_address', ``, 'string') }}",
            "Invoice Total": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Invoice_Total', ``, 'number') }}",
            "Invoice Number": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Invoice_Number', ``, 'string') }}",
            "Ship to address": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Ship_to_address', ``, 'string') }}",
            "Invoice SubTotal": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Invoice_SubTotal', ``, 'number') }}"
          },
          "schema": [
            {
              "id": "Invoice Number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Invoice Number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice date",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Invoice date",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice SubTotal",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Invoice SubTotal",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice tax",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Invoice tax",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Invoice Total",
              "type": "number",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Invoice Total",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Currency",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Currency",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Vendor name",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Vendor name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email address",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Email address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Phone number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Ship to address",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Ship to address",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "9jCNxhVQFJQuxhGU",
          "name": "Airtable Personal Access Token account"
        }
      },
      "typeVersion": 2.1
    }
  ],
  "pinData": {},
  "connections": {
    "a364c562-5092-4c88-8a80-2271997dee0d": {
      "main": [
        [
          {
            "node": "13144779-2c29-47bd-bf46-5d58b272564c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "13144779-2c29-47bd-bf46-5d58b272564c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "13144779-2c29-47bd-bf46-5d58b272564c",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "13144779-2c29-47bd-bf46-5d58b272564c": {
      "main": [
        [
          {
            "node": "28d2c502-3104-4d18-ab1c-2fd14495a3cf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "cab3796a-87ed-4a33-9eb6-f73f5da840cc": {
      "main": [
        [
          {
            "node": "d702cf55-1761-4b31-9e8e-e8ceb1da9171",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "9c13f6b8-626a-4eb0-80ff-90b093d1948d": {
      "main": [
        [
          {
            "node": "a364c562-5092-4c88-8a80-2271997dee0d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d702cf55-1761-4b31-9e8e-e8ceb1da9171": {
      "main": [
        [
          {
            "node": "f264557e-3691-4c64-97a9-5ca11cf58789",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "9c13f6b8-626a-4eb0-80ff-90b093d1948d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f264557e-3691-4c64-97a9-5ca11cf58789": {
      "main": [
        [
          {
            "node": "a364c562-5092-4c88-8a80-2271997dee0d",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "880b0f62-07e1-495e-b36a-948c5eb70c27": {
      "ai_tool": [
        [
          {
            "node": "28d2c502-3104-4d18-ab1c-2fd14495a3cf",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "b7d49dfb-9e34-4ef3-8533-938a5dc1bbcb": {
      "main": [
        [
          {
            "node": "cab3796a-87ed-4a33-9eb6-f73f5da840cc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "dda2ddaa-ff24-4694-95c8-5e3d5cfaa88d": {
      "ai_languageModel": [
        [
          {
            "node": "28d2c502-3104-4d18-ab1c-2fd14495a3cf",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "28d2c502-3104-4d18-ab1c-2fd14495a3cf": {
      "main": [
        [
          {
            "node": "4ce9888a-1534-41eb-9636-87b861e7ea79",
            "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é - Résumé IA, IA Multimodale

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œuds18
Catégorie2
Types de nœuds12
Description de la difficulté

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

Liens externes
Voir sur n8n.io

Partager ce workflow

Catégories

Catégories: 34