Colombian Invoices Processing

This workflow aims to automate the entire process of handling personal electronic invoices in Colombia. It includes regularly fetching emails with .zip attachments from Gmail, extracting the files, extracting and validating invoice information, and structuring the data for recording in Google Sheets. By integrating intelligent analysis tools, it ensures the accuracy of invoice data and uploads the original files to Google Drive for easy archiving and management, significantly enhancing the efficiency and compliance of financial operations.

Workflow Diagram
Colombian Invoices Processing Workflow diagram

Workflow Name

Colombian Invoices Processing

Key Features and Highlights

This workflow automates the entire process of receiving, decompressing, extracting content from, validating, and archiving Colombian personal electronic invoices. Highlights include:

  • Automatically fetches emails with .zip attachments from Gmail every 30 minutes to ensure timely acquisition of invoice files.
  • Automatically decompresses .zip files and filters PDF and XML invoice documents for separate processing.
  • Integrates OpenAI GPT-4o-mini model and LangChain Agent to intelligently extract key invoice information such as invoice type, number, date, both parties’ NIT numbers, amount details, CUFE code, and purchase summary.
  • Uses a calculator node to verify the accuracy of the invoice total (Total = Amount before tax + Tax amount).
  • Automatically uploads original PDFs to Google Drive and renames them following the “YYYY-MM-DD-InvoiceNumber.pdf” format for convenient archiving and management.
  • Structures extracted invoice data and writes it into Google Sheets, using a unique key (Invoice Number + Issuer’s NIT) to avoid duplicate records.

Core Problems Addressed

Manual processing of electronic invoices is time-consuming and error-prone, especially when dealing with multiple file formats (PDF, XML) and complex data validation. This workflow automates batch processing of invoice files, intelligent data extraction, and verification, significantly improving invoice management efficiency and accuracy while reducing human operational risks.

Application Scenarios

  • Financial invoice management for individuals or small businesses in Colombia.
  • Automated organization and archiving of electronic invoices to ensure compliance with Colombian tax authority DIAN requirements.
  • Scenarios requiring periodic bulk retrieval, processing, and recording of invoice data from email inboxes.

Main Process Steps

  1. Email Trigger: Scans Gmail every 30 minutes to filter emails containing .zip attachments.
  2. File Filtering and Decompression: Filters ZIP files, decompresses them, and extracts PDF and XML files.
  3. Data Extraction: Extracts text from PDFs and converts XML files to JSON, then merges the data.
  4. AI-Powered Analysis: Utilizes OpenAI GPT model and LangChain Agent to extract detailed invoice information and verifies amounts via a calculator node.
  5. File Storage: Uploads PDFs to Google Drive and renames files according to preset rules.
  6. Data Recording: Writes invoice information into Google Sheets to maintain the invoice data table.

Involved Systems or Services

  • Gmail (email triggering and attachment downloading)
  • OpenAI GPT-4o-mini (intelligent text parsing)
  • LangChain Agent (structured information extraction)
  • Google Drive (invoice PDF storage and management)
  • Google Sheets (invoice data recording and updating)

Target Users and Value

  • Financial personnel, accountants, and small to medium business owners in Colombia, especially those handling large volumes of electronic invoices.
  • Individuals or teams seeking to reduce manual data entry and verification through automation.
  • Users requiring accurate, standardized invoice information and clear archiving to meet compliance needs.

This workflow leverages high automation and intelligent analysis to significantly enhance the efficiency and data quality of Colombian electronic invoice processing, empowering users to easily manage tax and financial challenges.

Colombian Invoices Processing