Library / Files & Cloud Storage
Files & Cloud Storage
Extract and validate invoice PDFs into Excel with OpenAI GPT-4o-mini
On a schedule, it manages files with OpenAI / ChatGPT.
What it does
## InvoiceExtractor-Local ### How it works This workflow runs on a schedule, detects whether it is running in a local deployment, builds a local invoice-processing configuration, and creates an execution report. It reads PDF invoices from disk, extracts and cleans their text, sends the content to an OpenAI model, normalizes and validates the AI output, then writes structured JSON results. Valid, invalid, and extraction-error files are routed to separate local folders, removed from the input folder, and the batch loop continues until all files are processed. ### Setup steps - Configure the Schedule Trigger cadence for how often the local invoice folder should be processed. - Run n8n in a self-hosted/local environment with filesystem access enabled; the deployment detection node notes that NODE_FUNCTION_ALLOW_BUILTIN=fs is required. - Create and permission the expected local invoice directories, including the input folder and destination folders for valid, invalid, error, and report output files. - Add valid OpenAI credentials to the OpenAI node and confirm the selected model/prompt can return invoice data in the expected JSON structure. - Review the configuration and file path code nodes so their paths match the machine or container where n8n is running. ### Customization Adjust the invoice validation rules, OpenAI prompt/model, output JSON schema, local folder paths, and execution report content to match your invoice format and operational requirements.
The steps
- Clean Extracted Text
- OpenAI Invoice Processing
- Normalize AI Output
- Split JSON Output
- Extract Data from PDF
- When Scheduled at 4am
- Initialize Exec Report Content
- Generate Exec Report File
- Load PDFs from Disk
- Loop Over File Batches
- Convert JSON to File
- Manage Files on Disk
- Set Initial Configurations
- Transform Data to File Format
40 steps in total.
Similar automations
Documents, PDF & OCRExtract Turkish invoice data from Gmail PDFs into Google Sheets with Gemini21 stepsEmail AutomationExtract consultant hours from PDF timesheets with Azure OpenAI and Excel9 stepsFinance, Invoices & AccountingProcess Invoices with Mistral OCR and GPT-4o mini10 stepsFinance, Invoices & AccountingCreate and Email Invoice Ninja Invoices from Sheets4 steps