This comprehensive workflow automates the entire invoice processing pipeline by monitoring a Google Drive folder for new invoice uploads, intelligently processing both PDF and image formats, extracting structured data using AI-powered information extraction, and automatically organizing the results in a Google Sheet while sending email notifications. The system handles various file formats and includes smart fallback mechanisms for challenging documents like CamScanner PDFs.
File Monitoring : The workflow continuously monitors a specified Google Drive folder for new invoice files using a trigger that checks every minute for newly created files.
File Processing : When new files are detected, the system downloads them and determines the file type (PDF or image) using a smart switch mechanism.
Text Extraction :
AI Information Extraction : Processes the extracted text through OpenAI's language model to identify and extract key invoice information including:
Data Storage : Automatically appends the extracted information to a Google Sheet with links back to the original scanned documents.
Notification : Sends formatted email notifications via Mailgun when new invoices are processed, including an HTML table summary.
Setup Google Drive : Create a dedicated folder in Google Drive for invoice uploads and note the folder ID.
Configure Credentials : Set up the following credential connections in n8n:
Update Configuration :
Test the Workflow : Use the manual trigger to process existing invoices in your folder for initial testing.
Activate : Enable the workflow to start automatic monitoring of new invoice uploads.
External APIs:
Google Services:
Setup Prerequisites:
Recommended Settings:


