AutomationFlowsAI & RAG › Extract Colombian Invoice Data From Drive to Sheets with Gpt-4o

Extract Colombian Invoice Data From Drive to Sheets with Gpt-4o

ByCaio Garvil @caiogarvil on n8n.io

This workflow is designed for finance professionals, accountants, small business owners in Colombia, or anyone needing to automate the extraction of invoice data and its entry into Google Sheets. It's particularly useful for handling Colombian tax and legal specifics.

Event trigger★★★★☆ complexityAI-powered29 nodesLm Chat Azure Open AiOutput Parser StructuredGoogle Drive TriggerGoogle DriveChain LlmGoogle Sheets
AI & RAG Trigger: Event Nodes: 29 Complexity: ★★★★☆ AI nodes: yes Added:
Extract Colombian Invoice Data From Drive to Sheets with Gpt-4o — n8n workflow card showing Lm Chat Azure Open Ai, Output Parser Structured, Google Drive Trigger integration

This workflow corresponds to n8n.io template #8099 — we link there as the canonical source.

This workflow follows the Chainllm → Google Drive recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "ECMZJMXpsiEjYfDJ",
  "name": "Colombia Cashflow - To sell",
  "tags": [],
  "nodes": [
    {
      "id": "a9dae29e-d7d9-4e21-a34f-e4101e6497c8",
      "name": "Azure OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        -80,
        620
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "a3aea9f0-ef87-467b-b727-9f9217f24635",
      "name": "Azure OpenAI Chat Model2",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        280,
        580
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "6cc187a7-6165-4816-9c4b-92a46173a9f8",
      "name": "Azure OpenAI Chat Model3",
      "type": "@n8n/n8n-nodes-langchain.lmChatAzureOpenAi",
      "position": [
        280,
        180
      ],
      "parameters": {
        "model": "gpt-4o",
        "options": {}
      },
      "typeVersion": 1
    },
    {
      "id": "c7626ba8-b70d-43bc-8001-edca4adcbd96",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        440,
        220
      ],
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"title\": \"InvoiceExtraction\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"modification_date\": {\n      \"type\": \"string\",\n      \"description\": \"Today's date in strictly DD/MM/YYYY format (e.g., 06/05/2025).\"\n    },\n    \"vendor\": {\n      \"type\": \"string\",\n      \"description\": \"Name of the company sending the invoice.\"\n    },\n    \"items\": {\n      \"type\": \"array\",\n      \"description\": \"Line items included in the invoice.\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"description\": {\n            \"type\": \"string\",\n            \"description\": \"Description of the product or service.\"\n          },\n          \"sub_total\": {\n            \"type\": \"number\",\n            \"description\": \"Total for this line before tax.\"\n          },\n          \"iva_value\": {\n            \"type\": \"number\",\n            \"description\": \"Value of the VAT (IVA). If not present, return 0.\"\n          },\n          \"total_amount\": {\n            \"type\": \"number\",\n            \"description\": \"Final total amount (subtotal + tax).\"\n          },\n          \"category\": {\n            \"type\": \"string\",\n            \"enum\": [\n              \"Administrative expenses\",\n              \"HR expenses\",\n              \"Legal expenses\",\n              \"Tax expenses\",\n              \"Project expenses\"\n            ],\n            \"description\": \"Category of the cost.\"\n          },\n          \"sub_category\": {\n            \"type\": \"string\",\n            \"enum\": [\n              \"Contador\",\n              \"Transportations, Flights\",\n              \"Marketing\",\n              \"Afiliaci\u00f3n Artefact\",\n              \"Equipos empleados\",\n              \"Plataforma Reclutamiento\",\n              \"Seguros empresa\",\n              \"Other (documents, telco...)\",\n              \"Payback Benjamin Solins\",\n              \"Payback Ana Maria Cardenas\",\n              \"Payback Felipe Garcia\",\n              \"Salario Ordinario\",\n              \"MiPlanilla\",\n              \"Celular\",\n              \"Prima\",\n              \"Cowork\",\n              \"GTG\",\n              \"Teambuilding (lunch, coffee...)\",\n              \"People Pass\",\n              \"Bank Fees (subscription)\",\n              \"Bank Fees (pago otros bancos)\",\n              \"Bank Fees (nominas)\",\n              \"Bank Fees (proveedores)\",\n              \"Lawyers\",\n              \"SST\",\n              \"Fees\",\n              \"Sanofi\",\n              \"Totto\",\n              \"BCP\",\n              \"Retenci\u00f3n ingresos Artefact\",\n              \"Retefuente\",\n              \"ReteICA\",\n              \"IVA Ventas\",\n              \"El 4/1000\"\n            ],\n            \"description\": \"Sub-category of the cost.\"\n          }\n        },\n        \"required\": [\n          \"description\",\n          \"sub_total\",\n          \"iva_value\",\n          \"total_amount\",\n          \"category\",\n          \"sub_category\"\n        ]\n      }\n    },\n    \"retefuente\": {\n      \"type\": \"number\",\n      \"description\": \"Withholding tax value. If not present, return 0.\"\n    },\n    \"reteica\": {\n      \"type\": \"number\",\n      \"description\": \"Industry and commerce withholding tax value. If not present, return 0.\"\n    },\n    \"number_of_items\": {\n      \"type\": \"integer\",\n      \"description\": \"How many items were generated.\"\n    }\n  },\n  \"required\": [\n    \"modification_date\",\n    \"vendor\",\n    \"items\",\n    \"retefuente\",\n    \"reteica\",\n    \"number_of_items\"\n  ]\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "61a9a659-d8a3-4135-8881-495de4b07f7e",
      "name": "1a. Updated file trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "notes": "Need to set a specific folder in Google drive",
      "position": [
        -760,
        100
      ],
      "parameters": {
        "event": "fileUpdated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "REDACTED",
          "cachedResultUrl": "REDACTED",
          "cachedResultName": "Test Executer - July"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "c82b3a82-67fb-47f3-bf7d-43efb8562d14",
      "name": "1b. Created file trigger",
      "type": "n8n-nodes-base.googleDriveTrigger",
      "notes": "Need to set a specific folder in Google drive",
      "position": [
        -760,
        320
      ],
      "parameters": {
        "event": "fileCreated",
        "options": {},
        "pollTimes": {
          "item": [
            {
              "mode": "everyMinute"
            }
          ]
        },
        "triggerOn": "specificFolder",
        "folderToWatch": {
          "__rl": true,
          "mode": "list",
          "value": "REDACTED",
          "cachedResultUrl": "REDACTED",
          "cachedResultName": "Test Executer - July"
        }
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "7ccb8771-dc93-4eca-9453-e5211ebede68",
      "name": "2. Download file",
      "type": "n8n-nodes-base.googleDrive",
      "notes": "Either updated or created will activate this node",
      "position": [
        -520,
        220
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "REDACTED"
        },
        "options": {},
        "operation": "download"
      },
      "notesInFlow": true,
      "typeVersion": 3
    },
    {
      "id": "82077f21-d43c-4a7b-ba71-8509054da1fc",
      "name": "3. Route",
      "type": "n8n-nodes-base.switch",
      "notes": "Switch based on File Extension",
      "position": [
        -300,
        220
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "REDACTED",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.name }}",
                    "rightValue": "pdf"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "REDACTED",
                    "operator": {
                      "type": "string",
                      "operation": "contains"
                    },
                    "leftValue": "={{ $json.name }}",
                    "rightValue": "jpeg"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "notesInFlow": true,
      "typeVersion": 3.2
    },
    {
      "id": "38da37e0-0eac-44cc-83cc-8bd13decbbb2",
      "name": "5. Reasoning Agent",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "notes": "Output the desired data",
      "position": [
        280,
        0
      ],
      "parameters": {
        "text": "=",
        "messages": {
          "messageValues": [
            {
              "type": "HumanMessagePromptTemplate",
              "message": "=Here is the document you need to pull our from: {{ $json.text }}"
            },
            {
              "message": "=You are a Colombian Tax and Legal Extraction Agent, fluent in both English and Spanish. You have an in-depth understanding of Colombian law, including all tax regulations applicable to services in Colombia.\nAlso you are fantastic at pulling out JSON data from invoices or receipts or documents."
            },
            {
              "type": "AIMessagePromptTemplate",
              "message": "=I want you to output the data in the following format:\n{\n  // Today's date. The format must be strictly DD/MM/YYYY (e.g., 06/05/2025). Do not return any other format. Get the today's date always\n  \"modification_date\": {{$now.toISO().split('T')[0]}},\n\n  // Name of the company sending the invoice\n    \"vendor\": \"ABC Solutions Ltd.\"\n\n  // Line items included in the invoice\n  \"items\": [\n    {\n      // Description of the product or service\n      \"description\": \"Website design and development\",\n\n      // Total for this line\n      \"sub_total\": 5000.00,\n\n      // The value of the VAT (IVA). If the VAT amount is explicitly stated in the document, return that value. If it is not stated, return 0.\n    \"iva_value\": 580.00,\n\n      // Final total amount to be paid (subtotal + tax)\n  \"total_amount\": 5580.00,\n\n  // Category of the cost \u2014 possible options:\n  // \"Administrative expenses\", \"HR expenses\", \"Legal expenses\", \"Tax expenses\", \"Project expenses\"\n  // Choose the most appropriate category.\n  \"category\": \"Administrative expenses\",\n\n  // Sub-category of the cost \u2014 possible options:\n  // \"Contador\", \"Transportations, Flights\", \"Marketing\", \"Afiliaci\u00f3n Artefact\", \"Equipos empleados\",\n  // \"Plataforma Reclutamiento\", \"Seguros empresa\", \"Other (documents, telco...)\", \"Payback Benjamin Solins\",\n  // \"Payback Ana Maria Cardenas\", \"Payback Felipe Garcia\", \"Salario Ordinario\", \"MiPlanilla\", \"Celular\",\n  // \"Prima\", \"Cowork\", \"GTG\", \"Teambuilding (lunch, coffee...)\", \"People Pass\", \"Bank Fees (subscription)\",\n  // \"Bank Fees (pago otros bancos)\", \"Bank Fees (nominas)\", \"Bank Fees (proveedores)\", \"Lawyers\", \"SST\",\n  // \"Fees\", \"Sanofi\", \"Totto\", \"BCP\", \"Retenci\u00f3n ingresos Artefact\", \"Retefuente\", \"ReteICA\", \"IVA Ventas\",\n  // \"El 4/1000\"\n  // Choose the most appropriate sub-category.\n  \"sub_category\": \"Marketing\"\n\n    },\n    {\n      \"description\": \"Monthly website maintenance (June 2025)\",\n      \"sub_total\": 300.00,\n      \"iva_value\": 50,\n      \"total_amount\": 350,\n      \"category\": \"Legal expenses\",\n      \"sub_category\": \"Lawyers\"\n    },\n    {\n      \"description\": \"Additional support hours\",\n      \"sub_total\": 500.00,\n      \"iva_value\": 100,\n      \"total_amount\": 600\n      \"category\": \"Tax expenses\",\n      \"sub_category\": \"Fees\"\n    }\n  ],\n\n\n  // If there is any retefuente (withholding tax) mentioned in the document, extract its value. If not present, return 0.\n  \"retefuente\": \"0\"\n\n  // If there is any reteICA (industry and commerce withholding tax) mentioned in the document, extract its value. If not present, return 0.\n  \"reteica\": \"10\"\n\n  // how many items it has generated\n  \"number_of_items\"\n\n}\n\nYour code must be a JSON and nothing more. Make sure the markdown strings you output are a valid JSON and don't use any special character that might break the json."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "notesInFlow": true,
      "typeVersion": 1.5
    },
    {
      "id": "7b165f99-246c-452f-8bcd-b63af6fecc3f",
      "name": "6. Edit Field",
      "type": "n8n-nodes-base.set",
      "notes": "Make sure its a valid output",
      "position": [
        640,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "REDACTED",
              "name": "response.text",
              "type": "object",
              "value": "REDACTED"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "21cde7a5-feb1-4fac-b48c-d90fc4823084",
      "name": "7. Split data",
      "type": "n8n-nodes-base.splitOut",
      "notes": "Split data intro multiple items",
      "position": [
        880,
        0
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "response.text.items"
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "0a412ce8-615b-4580-bfce-d33a8da84f84",
      "name": "8. Fill Template",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "Upload data in the desired tempalte",
      "position": [
        1100,
        0
      ],
      "parameters": {
        "columns": {
          "value": "REDACTED",
          "schema": [
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "REDACTED",
          "cachedResultUrl": "REDACTED",
          "cachedResultName": "Cash out Colombia"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "REDACTED",
          "cachedResultUrl": "REDACTED",
          "cachedResultName": "CashFlow Colombia 2024/2025"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.5
    },
    {
      "id": "52a48790-264a-4404-af68-b21d32d204e1",
      "name": "4. Extract data from PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "notes": "If PDF, extract data from PDF",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {},
        "operation": "pdf"
      },
      "notesInFlow": false,
      "typeVersion": 1
    },
    {
      "id": "18f29b56-0ae8-47da-9038-aebf7325da6f",
      "name": "4. Extract Data Agent",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "notes": "If its JPEG",
      "position": [
        -80,
        400
      ],
      "parameters": {
        "text": "=Please pull out all the text from the image",
        "messages": {
          "messageValues": [
            {
              "type": "HumanMessagePromptTemplate",
              "messageType": "imageBinary"
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "notesInFlow": true,
      "typeVersion": 1.5
    },
    {
      "id": "5c76b51d-7501-4b34-bcb1-7a5638bbad34",
      "name": "5. Reasoning Agent1",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "notes": "Output the desired data",
      "position": [
        280,
        400
      ],
      "parameters": {
        "text": "=",
        "messages": {
          "messageValues": [
            {
              "type": "HumanMessagePromptTemplate",
              "message": "=Here is the document you need to pull our from: {{ $json.response.text }}"
            },
            {
              "message": "=You are a Colombian Tax and Legal Extraction Agent, fluent in both English and Spanish. You have an in-depth understanding of Colombian law, including all tax regulations applicable to services in Colombia.\nAlso you are fantastic at pulling out JSON data from invoices or receipts or documents."
            },
            {
              "type": "AIMessagePromptTemplate",
              "message": "=I want you to output the data in the following format:\n{\n  // Today's date. The format must be strictly DD/MM/YYYY (e.g., 06/05/2025). Do not return any other format. Get the today's date always\n  \"modification_date\": {{$now.toISO().split('T')[0]}},\n\n  // Name of the company sending the invoice\n    \"vendor\": \"ABC Solutions Ltd.\"\n\n  // Line items included in the invoice\n  \"items\": [\n    {\n      // Description of the product or service\n      \"description\": \"Website design and development\",\n\n      // Total for this line\n      \"sub_total\": 5000.00,\n\n      // The value of the VAT (IVA). If the VAT amount is explicitly stated in the document, return that value. If it is not stated, return 0.\n    \"iva_value\": 580.00,\n\n      // Final total amount to be paid (subtotal + tax)\n  \"total_amount\": 5580.00,\n\n  // Category of the cost \u2014 possible options:\n  // \"Administrative expenses\", \"HR expenses\", \"Legal expenses\", \"Tax expenses\", \"Project expenses\"\n  // Choose the most appropriate category.\n  \"category\": \"Administrative expenses\",\n\n  // Sub-category of the cost \u2014 possible options:\n  // \"Contador\", \"Transportations, Flights\", \"Marketing\", \"Afiliaci\u00f3n Artefact\", \"Equipos empleados\",\n  // \"Plataforma Reclutamiento\", \"Seguros empresa\", \"Other (documents, telco...)\", \"Payback Benjamin Solins\",\n  // \"Payback Ana Maria Cardenas\", \"Payback Felipe Garcia\", \"Salario Ordinario\", \"MiPlanilla\", \"Celular\",\n  // \"Prima\", \"Cowork\", \"GTG\", \"Teambuilding (lunch, coffee...)\", \"People Pass\", \"Bank Fees (subscription)\",\n  // \"Bank Fees (pago otros bancos)\", \"Bank Fees (nominas)\", \"Bank Fees (proveedores)\", \"Lawyers\", \"SST\",\n  // \"Fees\", \"Sanofi\", \"Totto\", \"BCP\", \"Retenci\u00f3n ingresos Artefact\", \"Retefuente\", \"ReteICA\", \"IVA Ventas\",\n  // \"El 4/1000\"\n  // Choose the most appropriate sub-category.\n  \"sub_category\": \"Marketing\"\n\n    },\n    {\n      \"description\": \"Monthly website maintenance (June 2025)\",\n      \"sub_total\": 300.00,\n      \"iva_value\": 50,\n      \"total_amount\": 350,\n      \"category\": \"Legal expenses\",\n      \"sub_category\": \"Lawyers\"\n    },\n    {\n      \"description\": \"Additional support hours\",\n      \"sub_total\": 500.00,\n      \"iva_value\": 100,\n      \"total_amount\": 600\n      \"category\": \"Tax expenses\",\n      \"sub_category\": \"Fees\"\n    }\n  ],\n\n\n  // If there is any retefuente (withholding tax) mentioned in the document, extract its value. If not present, return 0.\n  \"retefuente\": \"0\"\n\n  // If there is any reteICA (industry and commerce withholding tax) mentioned in the document, extract its value. If not present, return 0.\n  \"reteica\": \"10\"\n\n  // how many items it has generated\n  \"number_of_items\"\n\n}\n\nThe output MUST be a JSON, only the JSON and nothing more The output MUST be a JSON, only the JSON and nothing more. DO NOT include any other formatting, or characters around, such as ```.\nI want you to return only the format above, nothing more."
            }
          ]
        },
        "promptType": "define",
        "hasOutputParser": true
      },
      "notesInFlow": true,
      "typeVersion": 1.5
    },
    {
      "id": "186dd2c0-b9ac-4f9c-a71b-256708f63cb7",
      "name": "6. Edit Field1",
      "type": "n8n-nodes-base.set",
      "notes": "Make sure its valid output",
      "position": [
        640,
        400
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "REDACTED",
              "name": "response.text",
              "type": "object",
              "value": "REDACTED"
            }
          ]
        }
      },
      "notesInFlow": true,
      "typeVersion": 3.4
    },
    {
      "id": "ae385333-b871-4e47-bfe4-139000d0886e",
      "name": "7. Split Data",
      "type": "n8n-nodes-base.splitOut",
      "notes": "Split data intro multiple items",
      "position": [
        880,
        400
      ],
      "parameters": {
        "options": {},
        "fieldToSplitOut": "response.text.items"
      },
      "notesInFlow": true,
      "typeVersion": 1
    },
    {
      "id": "ad973265-ab85-4acd-94d6-c7ecdb9f97b2",
      "name": "8. Fill Template1",
      "type": "n8n-nodes-base.googleSheets",
      "notes": "Upload data in the desired tempalte",
      "position": [
        1120,
        400
      ],
      "parameters": {
        "columns": {
          "value": "REDACTED",
          "schema": [
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "REDACTED",
              "type": "string",
              "display": true,
              "removed": true,
              "required": false,
              "displayName": "REDACTED",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "REDACTED",
          "cachedResultUrl": "REDACTED",
          "cachedResultName": "Cash out Colombia"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "REDACTED",
          "cachedResultUrl": "REDACTED",
          "cachedResultName": "CashFlow Colombia 2024/2025"
        }
      },
      "notesInFlow": true,
      "typeVersion": 4.5
    },
    {
      "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\u2019s it for\nThis workflow is designed for **finance professionals, accountants, small business owners in Colombia**, or anyone needing to automate the extraction of invoice data and its entry into Google Sheets. It's particularly useful for handling Colombian tax and legal specifics.\n\n## How it works / What it does\nThis workflow automates the process of extracting critical data from invoices and receipts (PDFs and JPEGs) and organizing it in a Google Sheet:\n*   **Triggers:** The workflow initiates when a new file is created or an existing file is updated in a designated Google Drive folder.\n*   **File Handling:** It first downloads the detected file.\n*   **Routing:** A \"Switch\" node intelligently routes the file based on its extension \u2013 one path for PDFs and another for JPEGs.\n*   **Data Extraction:**\n    *   For **PDF files**, it directly extracts all text content from the document.\n    *   For **JPEG image files**, it utilizes an AI Agent (Azure OpenAI) to process the image and extract its textual content.\n*   **AI-Powered Reasoning:** Two \"Reasoning Agent\" nodes (Azure OpenAI Chat Models) act as a specialized \"Colombian Tax and Legal Extraction Agent\". They parse the extracted text from invoices to pull out structured data in JSON format, including:\n    *   Vendor name.\n    *   Modification date.\n    *   Line items with detailed description, sub_total, iva_value, total_amount, category, and sub_category.\n    *   Specific Colombian tax fields like Retefuente and ReteICA.\n    *   The number of items generated.\n*   **Output Parsing:** A \"Structured Output Parser\" node ensures that the AI's output strictly adheres to a predefined JSON schema, guaranteeing consistent data formatting.\n*   **Data Preparation:** \"Edit Field\" nodes ensure the AI's extracted data is in a valid format.\n*   **Item Splitting:** \"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 the Google Sheet.\n*   **Google Sheet Integration:** Finally, \"Fill Template\" nodes append the fully processed invoice data (per line item) into your designated Google Sheet.\n\n## How to set up\n1.  **Google Drive Credentials:** Ensure you have configured your Google Drive OAuth2 API credentials in n8n.\n2.  **Azure OpenAI Credentials:** Set up your Azure OpenAI API credentials, ensuring access to models like `gpt-4o`. Or you can simply use your traditional OpenAI or others LLMs.\n3.  **Google Sheets Credentials:** Configure your Google Sheets OAuth2 API credentials.\n4.  **Google Drive Folder ID:** In the \"1a. Updated file trigger\" and \"1b. Created file trigger\" nodes, **update the `folderToWatch` parameter** with your specific Google Drive Folder ID.\n5.  **Google Sheet ID and Sheet Name:** In the \"8. Fill Template\" and \"8. Fill Template1\" nodes, **update the `documentId` and `sheetName` parameters** with your specific Google Sheet ID and the name of the sheet where data should be appended.\n\n## Requirements\n*   An active n8n instance.\n*   A Google Drive account for file uploads.\n*   A Google Sheets account for data storage.\n*   An Azure OpenAI account with access to chat models (e.g., `gpt-4o`) for the \"Azure OpenAI Chat Model\" nodes and \"Extract Data Agent\".\n\n## How to customize the workflow\n*   **AI Extraction Prompts:** Modify the prompt instructions in the \"5. Reasoning Agent\" and \"5. Reasoning Agent1\" nodes if you need to extract different data points or change the output format.\n*   **Google Sheet Column Mappings:** Adjust the `columns` mapping in the \"8. Fill Template\" and \"8. Fill Template1\" nodes to match your specific Google Sheet headers and data requirements.\n*   **File Types:** Extend the \"3. Route\" node to handle additional file types (e.g., DOCX, PNG) by adding new conditions and corresponding extraction nodes."
      },
      "typeVersion": 1
    },
    {
      "id": "feeb8315-b30d-4817-bfef-260e9bd0a2ca",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -860,
        -260
      ],
      "parameters": {
        "color": 7,
        "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 Folder ID, replacing the placeholder `1DF90BXIwlIK3Yc1zCBQuC-uEvI2qm5hY`.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c9439ddf-8881-4df1-bfe8-e1e949aa1852",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        520
      ],
      "parameters": {
        "color": 7,
        "height": 240,
        "content": "## 2. Download File\n\nThis node downloads the detected file from Google Drive, preparing it for further processing.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "aca98e5b-d4a4-4149-a7d1-8da9599c60fd",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -380,
        -260
      ],
      "parameters": {
        "color": 7,
        "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"
      },
      "typeVersion": 1
    },
    {
      "id": "10c25499-ddeb-467d-8417-01ffcdc48bab",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -260
      ],
      "parameters": {
        "color": 7,
        "height": 220,
        "content": "## 4. Extract data from PDF\n\nFor PDF files, this node extracts all text content directly from the document."
      },
      "typeVersion": 1
    },
    {
      "id": "5002a2e8-6ea2-44d1-9207-3bcced15a154",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        220,
        -260
      ],
      "parameters": {
        "color": 7,
        "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"
      },
      "typeVersion": 1
    },
    {
      "id": "2fbe5ed6-5cac-4d8f-8983-6a9c9de77bbb",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        780
      ],
      "parameters": {
        "color": 7,
        "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"
      },
      "typeVersion": 1
    },
    {
      "id": "ed85ddbc-a28c-4529-8f87-c8def411e72d",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        600,
        -260
      ],
      "parameters": {
        "color": 7,
        "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"
      },
      "typeVersion": 1
    },
    {
      "id": "011be882-d382-4a31-9e0f-3a1131e39a54",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        860,
        -260
      ],
      "parameters": {
        "color": 7,
        "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 the Google Sheet."
      },
      "typeVersion": 1
    },
    {
      "id": "304ee8d0-ee10-4a46-9923-dd1999cbec1e",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1120,
        -260
      ],
      "parameters": {
        "color": 7,
        "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` and `sheetName` parameters** with your specific Google Sheet ID and sheet name, replacing the placeholder `13UcSbIRNuzuD50KLKMMy0azlXfGLPYE5hcD8flezQgc`.\n\nTemplate used on my automation: https://docs.google.com/spreadsheets/d/1E4SwEDaZGQHymsVmxaVvgPTYQj5GBDZJ5IiRud4Kru0/edit?usp=sharing"
      },
      "typeVersion": 1
    },
    {
      "id": "ab7b833c-3af1-4ca3-8dac-c55f17b62696",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2100,
        680
      ],
      "parameters": {
        "color": 4,
        "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 the n8n community.\n\n### **Have Feedback, a Question, or a Project Idea?**\n\nI'm here to help! Use this link for anything you need:\n\n#### \u27a1\ufe0f **[Click here to connect with me](https://www.linkedin.com/in/caiogarvil/)**\n\n*   **Give Feedback:** Share your thoughts on this template\u2014whether you found a typo, encountered an unexpected error, have a suggestion, or just want to say thanks!\n*   **n8n Coaching:** Get personalized, one-on-one guidance to master n8n. We can work together to get you launched with confidence or help you reach an expert level.\n*   **n8n Consulting:** Have a complex business challenge or need a custom workflow built from scratch? Let's partner on a powerful automation solution tailored to your specific needs.\n\n---\n\nHappy Automating!\n[Caio Garvil]"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "22b09ec4-4f99-4ff0-bb9a-a8b2f5d96353",
  "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
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

This workflow is designed for finance professionals, accountants, small business owners in Colombia, or anyone needing to automate the extraction of invoice data and its entry into Google Sheets. It's particularly useful for handling Colombian tax and legal specifics.

Source: https://n8n.io/workflows/8099/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow is designed to evaluate newly added CVs for Diversity, Equity, and Inclusion (DEI) eligibility. It automatically ingests CVs from Google Drive, extracts key fields, analyzes them with Az

Lm Chat Azure Open Ai, Output Parser Structured, Google Sheets Tool +5
AI & RAG

This comprehensive workflow automates the complete financial document processing pipeline using AI. Upload invoices via chat, drop expense receipts into a folder, or add bank statements - the system a

Chat Trigger, HTTP Request, Google Sheets +8
AI & RAG

This comprehensive n8n workflow automates the entire Meta (Facebook/Instagram) advertising process, from asset analysis to ad creation. It combines AI-powered content analysis with automated ad deploy

Facebook Graph Api, HTTP Request, Google Drive +5
AI & RAG

This end-to-end AI-powered recruitment automation workflow helps HR and talent acquisition teams automate the complete hiring pipeline—from resume intake and parsing to GPT-4-based evaluation, TA appr

Form Trigger, Output Parser Structured, Google Drive +10
AI & RAG

This workflow is perfect for graphic designers, creative agencies, marketing teams, or freelancers who regularly use AI-generated images in their projects. It's specifically beneficial for teams that

Google Sheets, Google Drive, HTTP Request +5