{
  "name": "Extract and organize Colombian invoices with Gmail, GPT-4o & Google Workspace",
  "nodes": [
    {
      "id": "3bcb9b75-a697-4948-974a-f4ea29947bfa",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        880,
        445
      ]
    },
    {
      "id": "03076b82-d824-4fe1-b659-7fbfa2f3fd87",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2420,
        790
      ]
    },
    {
      "id": "201ae476-d189-4ba7-9a96-6f272b95795d",
      "name": "Calculator",
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "position": [
        2540,
        790
      ]
    },
    {
      "id": "9aca7e2d-af43-4de6-aa07-2e880d660d20",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2660,
        790
      ]
    },
    {
      "id": "7793086c-b1f7-49f7-b67a-77721087fea5",
      "name": "On Email receipt",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        0,
        445
      ]
    },
    {
      "id": "97460873-8220-476b-97e7-cf433be3f9cd",
      "name": "Get Filename and mimeType",
      "type": "n8n-nodes-base.code",
      "position": [
        220,
        445
      ]
    },
    {
      "id": "e01cdfc7-c343-444e-a6ca-57b2139c3b6e",
      "name": "Filter ZIP files only",
      "type": "n8n-nodes-base.filter",
      "position": [
        440,
        445
      ]
    },
    {
      "id": "855b3a55-5d2e-4da1-aef7-76bf559da876",
      "name": "Unzip Invoice",
      "type": "n8n-nodes-base.compression",
      "position": [
        660,
        445
      ]
    },
    {
      "id": "c48abfc9-dff9-49ef-bb59-212f2f1eb472",
      "name": "Just for style",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1100,
        270
      ]
    },
    {
      "id": "b84984d5-f736-40be-b0b5-2d0a245c79a6",
      "name": "Get filename and mimeType on extracted docs",
      "type": "n8n-nodes-base.code",
      "position": [
        1100,
        470
      ]
    },
    {
      "id": "9ff8e500-8135-4960-81f5-fbc0945d45db",
      "name": "Split XML and PDF",
      "type": "n8n-nodes-base.switch",
      "position": [
        1320,
        470
      ]
    },
    {
      "id": "1132645b-9270-4581-9707-59bec4ee2417",
      "name": "Extract PDF Data",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1760,
        445
      ]
    },
    {
      "id": "215b29f9-0e0a-4989-a6d3-65faa5941729",
      "name": "Extract XML Data",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1540,
        645
      ]
    },
    {
      "id": "7fa1555e-11ae-4fca-b526-52d2b4a1773e",
      "name": "Convert to JSON",
      "type": "n8n-nodes-base.xml",
      "position": [
        1760,
        645
      ]
    },
    {
      "id": "cb581772-cb26-4d36-b1b9-c290f5a0a4ea",
      "name": "Append both Docs",
      "type": "n8n-nodes-base.merge",
      "position": [
        1980,
        570
      ]
    },
    {
      "id": "225b6fd6-4cfd-43d7-9c3e-fe20d97831d7",
      "name": "Aggregate all Data into 1 list",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        2200,
        580
      ]
    },
    {
      "id": "947001a4-bcdc-4421-bdce-07d41fc85c88",
      "name": "Extract Data from PDF and XML",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2452,
        570
      ]
    },
    {
      "id": "3eb86ff2-7a4b-4e17-af92-057b715fd69d",
      "name": "Create initial PDF",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2530,
        220
      ]
    },
    {
      "id": "cbe7bcf2-972b-4110-8d1c-075fcc34497a",
      "name": "Merge both flows",
      "type": "n8n-nodes-base.merge",
      "position": [
        2860,
        495
      ]
    },
    {
      "id": "14243355-766d-425d-90d1-6f114903636a",
      "name": "Update PDF with actual name",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        3080,
        495
      ]
    },
    {
      "id": "aa623454-553a-4b95-b320-964c68dd7555",
      "name": "Get Current Date",
      "type": "n8n-nodes-base.code",
      "position": [
        3300,
        495
      ]
    },
    {
      "id": "466a2885-adba-41ce-8a51-8c36db58a113",
      "name": "Create or update row",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        3520,
        620
      ]
    },
    {
      "id": "e7076c9e-1998-4aab-bb43-9d9f89a3377f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -60,
        -480
      ],
      "parameters": {
        "width": 960,
        "height": 880,
        "content": "# 🧾 Colombian electronic invoices processing\n\nThis N8N workflow automates the extraction and organization of **personal electronic invoices** in Colombia received via **Gmail**. It includes the follow"
      }
    }
  ],
  "connections": {
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "Extract Data from PDF and XML",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Unzip Invoice": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to JSON": {
      "main": [
        [
          {
            "node": "Append both Docs",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Just for style",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Get filename and mimeType on extracted docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append both Docs": {
      "main": [
        [
          {
            "node": "Aggregate all Data into 1 list",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract PDF Data": {
      "main": [
        [
          {
            "node": "Append both Docs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract XML Data": {
      "main": [
        [
          {
            "node": "Convert to JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Current Date": {
      "main": [
        [
          {
            "node": "Create or update row",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge both flows": {
      "main": [
        [
          {
            "node": "Update PDF with actual name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On Email receipt": {
      "main": [
        [
          {
            "node": "Get Filename and mimeType",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Extract Data from PDF and XML",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Split XML and PDF": {
      "main": [
        [
          {
            "node": "Create initial PDF",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract PDF Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Extract XML Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create initial PDF": {
      "main": [
        [
          {
            "node": "Merge both flows",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create or update row": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter ZIP files only": {
      "main": [
        [
          {
            "node": "Unzip Invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Extract Data from PDF and XML",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Get Filename and mimeType": {
      "main": [
        [
          {
            "node": "Filter ZIP files only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update PDF with actual name": {
      "main": [
        [
          {
            "node": "Get Current Date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Data from PDF and XML": {
      "main": [
        [
          {
            "node": "Merge both flows",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Aggregate all Data into 1 list": {
      "main": [
        [
          {
            "node": "Extract Data from PDF and XML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get filename and mimeType on extracted docs": {
      "main": [
        [
          {
            "node": "Split XML and PDF",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}