AI Document Data Extractor & CSV Converter using n8n, Gemini & LLMs
Integrates with:
Overview
Unlock Effortless Document Data Processing with this AI Agent
This n8n workflow acts as a powerful AI Agent designed to liberate you from manual data entry. It diligently monitors a specified Google Drive folder for new PDF documents (like bank statements or invoices) and images (such as transaction screenshots). For images, it employs Google's Vertex AI Gemini 1.5 Pro for advanced OCR and data extraction. For PDFs, it first extracts raw text and then sends it to a flexible LLM via OpenRouter (e.g., Meta Llama 3.1 70B) for intelligent parsing, categorization (like identifying transaction types), and structuring. The agent then neatly formats this extracted and processed data into a CSV file, which is automatically uploaded to another Google Drive folder for your convenience, streamlining your data pipeline and analysis preparation.
Key Features & Benefits
- Automated File Ingestion: Continuously monitors a Google Drive folder for new PDFs and images, triggering the extraction process automatically.
- AI-Powered Image Analysis: Utilizes Google Vertex AI (Gemini 1.5 Pro) for highly accurate text and structured data extraction directly from various image formats.
- AI-Powered PDF Processing: Leverages powerful Large Language Models (configurable via OpenRouter) to understand, parse, and structure complex data from PDF text content.
- Intelligent Data Categorization: Employs AI to categorize extracted information (e.g., financial transactions, line items) based on customizable prompts, adding significant value to raw data.
- Structured CSV Output: Converts the intelligently processed data into a clean, standardized CSV format, ready for import into spreadsheets, databases, or analytics tools.
- Automated Storage: Seamlessly uploads the generated CSV files to a designated Google Drive folder, ensuring organized and accessible records.
- Boost Efficiency: Drastically reduces time spent on manual data entry and document handling, freeing up your team for more strategic tasks.
- Enhance Data Accuracy: Minimizes human error associated with manual transcription and data processing.
Use Cases
- B2C E-commerce: Automatically extract order details from PDF invoices or images of packing slips, categorize items, and update inventory or financial records.
- B2B SaaS: Process uploaded bank statements or financial reports from clients, automatically categorizing transactions and generating summary CSVs for faster onboarding or financial analysis.
- Solopreneurs/Founders: Digitize and organize receipts or invoices from various formats (PDF, image) into structured CSVs for easy expense tracking and accounting.
- Automate the extraction of key information from scanned supplier invoices for direct import into accounting software, reducing manual processing for operations teams.
Prerequisites
- An n8n instance (Cloud or self-hosted).
- Google Cloud Platform account with:
- Google Drive API enabled.
- Vertex AI API enabled (for image processing).
- Google Service Account credentials configured in n8n with appropriate IAM permissions (e.g., 'Google Drive API access', 'Vertex AI User') for the respective services.
- For PDF processing via OpenRouter: An OpenRouter API Key and corresponding Header Auth credentials ('Authorization: Bearer YOUR_API_KEY') configured in the HTTP Request node in n8n.
Setup Instructions
- Download the n8n workflow JSON file.
- Import the workflow into your n8n instance.
- Google Drive Trigger ('Get PDF or Images'):
- Configure with your Google Service Account credentials.
- Specify the Google Drive
folderToWatch
where new PDFs/images will be uploaded. - Ensure your service account has at least 'Viewer' access to this folder.
- Google Drive Download Nodes ('Download PDF', 'Download Image'):
- Configure with the same Google Service Account credentials.
- Image Processing Path (Vertex AI Gemini):
- In the 'Google Gemini Chat Model' node, select or create your 'Google Gemini(PaLM) Api account' credentials. Ensure the associated service account has the 'Vertex AI User' role and the Vertex AI API is enabled in your GCP project.
- Review the prompt in the 'Vertex A.I. extract text' node and customize it if needed for your specific image content.
- PDF Processing Path (OpenRouter LLM):
- In the 'Send data to A.I.' (HTTP Request) node, configure your OpenRouter credentials. This typically involves setting an HTTP Header:
Authorization
with valueBearer YOUR_OPENROUTER_API_KEY
. - Customize the
model
(e.g.,meta-llama/llama-3.1-70b-instruct:free
) and thecontent
(prompt) in the JSON body of this node to match your requirements for PDF data extraction.
- In the 'Send data to A.I.' (HTTP Request) node, configure your OpenRouter credentials. This typically involves setting an HTTP Header:
- Google Drive Upload Nodes ('Upload to Google Drive', 'Upload to Google Drive1'):
- Configure with your Google Service Account credentials.
- Specify the
folderId
in Google Drive where the processed CSV files should be saved. Ensure your service account has 'Editor' access to this destination folder.
- Review Prompts: Carefully review and tailor the prompts in both the 'Vertex A.I. extract text' node (for images) and the 'Send data to A.I.' node (for PDFs) to ensure the AI accurately extracts and categorizes the data as you need.
- Activate the workflow. Test by uploading a sample PDF and a sample image to the monitored Google Drive folder.
Want your own unique AI agent?
Talk to us - we know how to build custom AI agents for your specific needs.
Schedule a Consultation