Skip to main content

Extract and organize Colombian invoices with Gmail, GPT-4o & Google Workspace

Workflow preview

Workflow preview
100%
Extract and organize Colombian invoices with Gmail, GPT-4o & Google Workspace preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

Personal Invoice Processor This N8N workflow automates the extraction and organization of personal invoices in Colombia received via Gmail . It includes the following key steps: Flow Summary ...

Best for

  • Invoice Processing automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.splitinbatches, @n8n/n8n-nodes-langchain.lmchatopenai, @n8n/n8n-nodes-langchain.toolcalculator, @n8n/n8n-nodes-langchain.outputparserstructured, n8n-nodes-base.gmailtrigger, n8n-nodes-base.code, n8n-nodes-base.filter, n8n-nodes-base.compression

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Juan Sanchez.

Original n8n.io source

1.1 Workflow description

Title
Extract and organize Colombian invoices with Gmail, GPT-4o & Google Workspace
Workflow name
Extract and organize Colombian invoices with Gmail, GPT-4o & Google Workspace

🧾 Personal Invoice Processor

This N8N workflow automates the extraction and organization of personal invoices in Colombia received via Gmail. It includes the following key steps:

🔁 Flow Summary

  1. Email Trigger

    • Polls Gmail every 30 minutes for emails with .zip attachments (assumed to contain invoices).
    • Expects ZIP file following DIAN standards.
  2. ZIP File Handling

    • Extracts all files.
    • Filters only PDF and XML files for processing.
  3. Data Extraction & Processing

    • Uses LangChain Agent + OpenAI (GPT-4o-mini) to extract:
      • Tipo de documento (Factura / Nota Crédito)
      • Número de factura
      • Fecha de emisión (YYYY-MM-DD)
      • NIT emisor y receptor (sin dígito de verificación)
      • Razón social del emisor
      • Subtotal, IVA, Total
      • CUFE
      • Resumen de compra (max 20 words, formatted sentence)
  4. Validation

    • Ensures Total = Subtotal + IVA using a calculator node.
  5. Storage

    • Uploads the original PDF to Google Drive.
    • Renames the file to: YYYY-MM-DD-NUMERO_FACTURA.pdf.
    • Inserts or updates invoice details in Google Sheets using a unique Key (NIT_Emisor + Numero_Factura) to prevent duplication.

> ⚙️ Designed for personal use with minimal latency tolerance and high automation reliability.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Loop Over Items

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 2 - OpenAI Chat Model

Type / Role
@n8n/n8n-nodes-langchain.lmChatOpenAi - lmChatOpenAi
Config choices
Version 1.2

Block 3 - Calculator

Type / Role
@n8n/n8n-nodes-langchain.toolCalculator - toolCalculator
Config choices
Version 1

Block 4 - Structured Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserStructured - outputParserStructured
Config choices
Version 1.2

Block 5 - On Email receipt

Type / Role
n8n-nodes-base.gmailTrigger - gmailTrigger
Config choices
Version 1.2

Block 6 - Get Filename and mimeType

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 7 - Filter ZIP files only

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 8 - Unzip Invoice

Type / Role
n8n-nodes-base.compression - compression
Config choices
Version 1.1

Block 9 - Just for style

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 10 - Get filename and mimeType on extracted docs

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 11 - Split XML and PDF

Type / Role
n8n-nodes-base.switch - switch
Config choices
Version 3.2

Block 12 - Extract PDF Data

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 13 - Extract XML Data

Type / Role
n8n-nodes-base.extractFromFile - extractFromFile
Config choices
Version 1

Block 14 - Convert to JSON

Type / Role
n8n-nodes-base.xml - xml
Config choices
Version 1

Block 15 - Append both Docs

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.1

Block 16 - Aggregate all Data into 1 list

Type / Role
n8n-nodes-base.aggregate - aggregate
Config choices
Version 1

Block 17 - Extract Data from PDF and XML

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.9

Block 18 - Create initial PDF

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 19 - Merge both flows

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.1

Block 20 - Update PDF with actual name

Type / Role
n8n-nodes-base.googleDrive - googleDrive
Config choices
Version 3

Block 21 - Get Current Date

Type / Role
n8n-nodes-base.code - code
Config choices
Version 2

Block 22 - Create or update row

Type / Role
n8n-nodes-base.googleSheets - googleSheets
Config choices
Version 4.5

Block 23 - Sticky Note

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

3. Summary Table

Workflow Extract and organize Colombian invoices with Gmail, GPT-4o & Google Workspace
Complexity advanced
Nodes 23
Categories Invoice Processing, AI Summarization
Author Juan Sanchez
Published 09 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/3951/3951.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Extract and organize Colombian invoices with Gmail, GPT-4o & Google Workspace do?

Personal Invoice Processor This N8N workflow automates the extraction and organization of personal invoices in Colombia received via Gmail . It includes the following key steps: Flow Summary ...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Invoice Processing, AI Summarization use case.