Process invoices and send weekly AI reports with OpenAI and Gmail
Go to WorkflowDescription
Overview
This workflow automates invoice handling from upload to reporting using AI.
Users submit invoices through a simple form. The workflow extracts key details, validates the data, stores valid invoices, and sends email notifications. It also generates a weekly summary report automatically.
This helps reduce manual data entry and ensures consistent invoice processing.
How It Works
Form Submission
Users upload an invoice (PDF or image) along with their email.
Initial Storage
The raw submission is stored for tracking and reference.
Text Extraction
The uploaded file is processed to extract text content.
AI Data Extraction
AI converts the raw text into structured invoice data such as invoice number, vendor, date, currency, and totals.
Validation
The workflow checks:
Date format (YYYY-MM-DD)
Allowed currencies
Total amount validity
Conditional Flow
If valid → invoice is stored and a success email is sent
If invalid → an error email is sent with details
Weekly Reporting
A scheduled trigger runs weekly to:
Fetch all validated invoices
Generate a summary report using AI
Send the report via email
Setup Instructions
Add your OpenAI credentials (used for data extraction and reporting)
Connect Gmail credentials for sending emails
Configure Data Tables:
invoice_form_submissions
validated_invoices
Update the Workflow Configuration node:
Set report recipient email
Adjust allowed currencies if needed
Ensure the file field (invoiceFile) is correctly mapped
Test with a sample invoice
Activate the workflow
Use Cases
Automating invoice processing for small businesses
Reducing manual accounting data entry
Validating invoices before storing them
Generating weekly financial summaries
Handling invoice submissions from clients or teams
Requirements
OpenAI API credentials
Gmail account (for sending emails)
n8n Data Tables (or replace with your preferred database)
n8n instance with file upload support
Notes
Make sure to fix the IF condition:
Use {{$json.validation.isValid}} instead of accessing isValid directly.
You can extend validation rules in the Code node based on your business needs.
The reporting section can be customized to include more insights or formats.