{
  "name": "Analyze invoices from Google Drive with AI and store data in Google Sheets",
  "nodes": [
    {
      "id": "ec461050-6e57-42d2-8da1-d821fc75bc45",
      "name": "Telegram Trigger",
      "type": "n8n-nodes-base.telegramTrigger",
      "position": [
        -64,
        512
      ]
    },
    {
      "id": "11242a3f-7f0d-476c-85d2-726438bb1077",
      "name": "Google Drive Trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -16,
        112
      ]
    },
    {
      "id": "e90299ba-e630-4154-bc63-a16b0a21d8e5",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        384,
        112
      ]
    },
    {
      "id": "3bc8ed92-6d9a-475a-a6c8-6b736d0b8161",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        608,
        112
      ]
    },
    {
      "id": "7380ef1f-7e54-459d-b094-1bfd1fd1264f",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        1136,
        128
      ]
    },
    {
      "id": "1833ff91-5dda-47cb-95cc-061faa0478de",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        1536,
        128
      ]
    },
    {
      "id": "11253a75-40bb-4ce7-8199-a92caaae359d",
      "name": "Edit Fields1",
      "type": "n8n-nodes-base.set",
      "position": [
        1136,
        -32
      ]
    },
    {
      "id": "a4b0b8d3-2567-4dd5-a52d-eb3c8c43b74b",
      "name": "Edit Fields2",
      "type": "n8n-nodes-base.set",
      "position": [
        1136,
        320
      ]
    },
    {
      "id": "bdc033cb-233f-4f45-b8d8-22c5a47c7ba2",
      "name": "Mapeo",
      "type": "n8n-nodes-base.set",
      "position": [
        192,
        112
      ]
    },
    {
      "id": "0a1e9300-a250-4e54-84fc-c85d2984f211",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        -1328
      ],
      "parameters": {
        "width": 1216,
        "height": 976,
        "content": "## Who this template is for\n\nThis workflow is designed for teams and businesses that receive invoices in Google Drive and want to automatically extract structured financial data without manual process"
      }
    },
    {
      "id": "947c9de7-c49d-48e4-8123-cd0792377a61",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -96,
        -192
      ],
      "parameters": {
        "width": 432,
        "height": 864,
        "content": "## A. Sticky: “Google Drive file detection”\n\nThis section monitors a Google Drive folder and extracts basic metadata from newly uploaded files to prepare them for processing."
      }
    },
    {
      "id": "05ecb110-0ecd-4395-bc1e-7406e7b284e3",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        768,
        -192
      ],
      "parameters": {
        "width": 944,
        "height": 864,
        "content": "This section handles invoice analysis for all supported file types (PDF and images).\n\nEach file is downloaded from Google Drive and processed using AI models optimized for document or image understand"
      }
    },
    {
      "id": "d8de7288-8080-4656-9f48-07cf63028c79",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        336,
        -192
      ],
      "parameters": {
        "width": 432,
        "height": 864,
        "content": "## B. Sticky: “File type classification\n\nThis step classifies each file based on its MIME type and routes it to the appropriate analysis flow for PDFs or images."
      }
    },
    {
      "id": "39fe4265-9083-4c57-8764-31ea1d595f4f",
      "name": "download image",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        816,
        -32
      ]
    },
    {
      "id": "4ccf5557-b5de-4b8b-9e86-e722117b2c15",
      "name": "Download PDF",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        816,
        128
      ]
    },
    {
      "id": "490fc439-0189-4d8a-9ee3-4cc32001341a",
      "name": "Download image",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        816,
        320
      ]
    },
    {
      "id": "b7eefab8-4250-435a-ada3-e9e02e8f7786",
      "name": "analyze image",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        976,
        -32
      ]
    },
    {
      "id": "9781a28f-c81b-457d-8fa8-3cad71607869",
      "name": "analyze image1",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "position": [
        976,
        320
      ]
    },
    {
      "id": "da92f962-968c-46bf-8203-af282f46e33c",
      "name": "analyze document",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        976,
        128
      ]
    },
    {
      "id": "315f2222-256e-4e36-8b06-987386b2863c",
      "name": "Put data in table",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1296,
        128
      ]
    },
    {
      "id": "e5ee0470-1c77-4355-889c-bb946eb142cc",
      "name": "Put data in table1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1296,
        -32
      ]
    },
    {
      "id": "8bba59a8-e9fc-41f1-b162-595525370915",
      "name": "Put data in table2",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1296,
        320
      ]
    },
    {
      "id": "f922cd0d-8aa8-42e3-b7a4-b1c4b2d18529",
      "name": "Save_drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        176,
        512
      ]
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Mapeo": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "download image",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Download image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Put data in table",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download PDF": {
      "main": [
        [
          {
            "node": "analyze document",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        [
          {
            "node": "Put data in table1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields2": {
      "main": [
        [
          {
            "node": "Put data in table2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "analyze image": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download image": {
      "main": [
        [
          {
            "node": "analyze image1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "analyze image1": {
      "main": [
        [
          {
            "node": "Edit Fields2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "download image": {
      "main": [
        [
          {
            "node": "analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Telegram Trigger": {
      "main": [
        [
          {
            "node": "Save_drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "analyze document": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Put data in table": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Put data in table1": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Put data in table2": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive Trigger": {
      "main": [
        [
          {
            "node": "Mapeo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}