{
  "name": "Extract Colombian invoice data from Drive to Sheets with GPT-4o",
  "nodes": [
    {
      "id": "a9dae29e-d7d9-4e21-a34f-e4101e6497c8",
      "name": "Azure OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -80,
        620
      ]
    },
    {
      "id": "a3aea9f0-ef87-467b-b727-9f9217f24635",
      "name": "Azure OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        280,
        580
      ]
    },
    {
      "id": "6cc187a7-6165-4816-9c4b-92a46173a9f8",
      "name": "Azure OpenAI Chat Model3",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        280,
        180
      ]
    },
    {
      "id": "c7626ba8-b70d-43bc-8001-edca4adcbd96",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        440,
        220
      ]
    },
    {
      "id": "61a9a659-d8a3-4135-8881-495de4b07f7e",
      "name": "1a. Updated file trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -760,
        100
      ]
    },
    {
      "id": "c82b3a82-67fb-47f3-bf7d-43efb8562d14",
      "name": "1b. Created file trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "position": [
        -760,
        320
      ]
    },
    {
      "id": "7ccb8771-dc93-4eca-9453-e5211ebede68",
      "name": "2. Download file",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        -520,
        220
      ]
    },
    {
      "id": "82077f21-d43c-4a7b-ba71-8509054da1fc",
      "name": "3. Route",
      "type": "n8n-nodes-base.switch",
      "position": [
        -300,
        220
      ]
    },
    {
      "id": "38da37e0-0eac-44cc-83cc-8bd13decbbb2",
      "name": "5. Reasoning Agent",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        280,
        0
      ]
    },
    {
      "id": "7b165f99-246c-452f-8bcd-b63af6fecc3f",
      "name": "6. Edit Field",
      "type": "n8n-nodes-base.set",
      "position": [
        640,
        0
      ]
    },
    {
      "id": "21cde7a5-feb1-4fac-b48c-d90fc4823084",
      "name": "7. Split data",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        880,
        0
      ]
    },
    {
      "id": "0a412ce8-615b-4580-bfce-d33a8da84f84",
      "name": "8. Fill Template",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1100,
        0
      ]
    },
    {
      "id": "52a48790-264a-4404-af68-b21d32d204e1",
      "name": "4. Extract data from PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        0,
        0
      ]
    },
    {
      "id": "18f29b56-0ae8-47da-9038-aebf7325da6f",
      "name": "4. Extract Data Agent",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -80,
        400
      ]
    },
    {
      "id": "5c76b51d-7501-4b34-bcb1-7a5638bbad34",
      "name": "5. Reasoning Agent1",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        280,
        400
      ]
    },
    {
      "id": "186dd2c0-b9ac-4f9c-a71b-256708f63cb7",
      "name": "6. Edit Field1",
      "type": "n8n-nodes-base.set",
      "position": [
        640,
        400
      ]
    },
    {
      "id": "ae385333-b871-4e47-bfe4-139000d0886e",
      "name": "7. Split Data",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        880,
        400
      ]
    },
    {
      "id": "ad973265-ab85-4acd-94d6-c7ecdb9f97b2",
      "name": "8. Fill Template1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1120,
        400
      ]
    },
    {
      "id": "276f2a18-0c80-41f7-8d56-1b6a98532ea0",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2100,
        -640
      ],
      "parameters": {
        "width": 1080,
        "height": 1260,
        "content": "## Automate Colombian Cashflow Data Extraction to Google Sheets with AI\n\n## Who’s it for\nThis workflow is designed for **finance professionals, accountants, small business owners in Colombia**, or any"
      }
    },
    {
      "id": "feeb8315-b30d-4817-bfef-260e9bd0a2ca",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -860,
        -260
      ],
      "parameters": {
        "width": 320,
        "height": 220,
        "content": "## 1a. and 1b.\nThese nodes trigger the workflow when a file is created or updated in your specified Google Drive folder. Remember to update the **'folderToWatch' parameter** with your Google Drive Fol"
      }
    },
    {
      "id": "c9439ddf-8881-4df1-bfe8-e1e949aa1852",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        520
      ],
      "parameters": {
        "width": null,
        "height": 240,
        "content": "## 2. Download File\n\nThis node downloads the detected file from Google Drive, preparing it for further processing.\n"
      }
    },
    {
      "id": "aca98e5b-d4a4-4149-a7d1-8da9599c60fd",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -260
      ],
      "parameters": {
        "width": null,
        "height": 220,
        "content": "## 2. Route\n\nThis node routes the workflow based on the file's extension, directing PDFs down one path and JPEGs down another.\n"
      }
    },
    {
      "id": "10c25499-ddeb-467d-8417-01ffcdc48bab",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -260
      ],
      "parameters": {
        "width": null,
        "height": 220,
        "content": "## 4. Extract data from PDF\n\nFor PDF files, this node extracts all text content directly from the document."
      }
    },
    {
      "id": "5002a2e8-6ea2-44d1-9207-3bcced15a154",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        -260
      ],
      "parameters": {
        "width": 340,
        "height": 220,
        "content": "## 5. Reasoning Agent & 5. Reasoning Agent1\n\nThese AI-powered 'Reasoning Agent' nodes (Azure OpenAI Chat Models, e.g., `gpt-4o`) act as a \"Colombian Ta"
      }
    },
    {
      "id": "2fbe5ed6-5cac-4d8f-8983-6a9c9de77bbb",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        780
      ],
      "parameters": {
        "width": null,
        "height": 220,
        "content": "## 4. Extract Data Agent\n\nFor JPEG image files, this node uses an AI Agent (Azure OpenAI Chat Model, e.g., `gpt-4o`) to extract t"
      }
    },
    {
      "id": "ed85ddbc-a28c-4529-8f87-c8def411e72d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        -260
      ],
      "parameters": {
        "width": null,
        "height": 220,
        "content": "## 6. Edit Field & 6. Edit Field1\n\nThese 'Edit Field' nodes ensure that the AI's extracted data is in a valid and usable format for subseq"
      }
    },
    {
      "id": "011be882-d382-4a31-9e0f-3a1131e39a54",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        860,
        -260
      ],
      "parameters": {
        "width": null,
        "height": 240,
        "content": "## 7. Split data & 7. Split Data\n\nThese 'Split data' nodes separate the 'items' array from the AI's output, allowing each individual line item from the invoice to be processed as a separate entry for "
      }
    },
    {
      "id": "304ee8d0-ee10-4a46-9923-dd1999cbec1e",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        -260
      ],
      "parameters": {
        "width": 460,
        "height": 240,
        "content": "## 8. Fill Template & 8. Fill Template1\n\nThese 'Fill Template' nodes append the fully processed invoice data (per line item) into your designated Google Sheet. Remember to **update the `documentId` an"
      }
    },
    {
      "id": "ab7b833c-3af1-4ca3-8dac-c55f17b62696",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2100,
        680
      ],
      "parameters": {
        "width": 1080,
        "height": 500,
        "content": "## Was this helpful? Let me know!\n\nI really hope this workflow helped you automate your cashflow management. Your feedback is incredibly valuable and helps me create better resources and solutions for"
      }
    }
  ],
  "connections": {
    "3. Route": {
      "main": [
        [
          {
            "node": "4. Extract data from PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "4. Extract Data Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6. Edit Field": {
      "main": [
        [
          {
            "node": "7. Split data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7. Split Data": {
      "main": [
        [
          {
            "node": "8. Fill Template1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7. Split data": {
      "main": [
        [
          {
            "node": "8. Fill Template",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "6. Edit Field1": {
      "main": [
        [
          {
            "node": "7. Split Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2. Download file": {
      "main": [
        [
          {
            "node": "3. Route",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5. Reasoning Agent": {
      "main": [
        [
          {
            "node": "6. Edit Field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "5. Reasoning Agent1": {
      "main": [
        [
          {
            "node": "6. Edit Field1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4. Extract Data Agent": {
      "main": [
        [
          {
            "node": "5. Reasoning Agent1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "4. Extract Data Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "1a. Updated file trigger": {
      "main": [
        [
          {
            "node": "2. Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "1b. Created file trigger": {
      "main": [
        [
          {
            "node": "2. Download file",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "4. Extract data from PDF": {
      "main": [
        [
          {
            "node": "5. Reasoning Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model2": {
      "ai_languageModel": [
        [
          {
            "node": "5. Reasoning Agent1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Azure OpenAI Chat Model3": {
      "ai_languageModel": [
        [
          {
            "node": "5. Reasoning Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "5. Reasoning Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}