{"product_id":"invoice-pdf-to-excel-extraction-with-gpt-4o-mini-in-n8n","title":"Invoice PDF to Excel Extraction with GPT-4o-mini in n8n","description":"\u003ch3\u003eAutomatically extract invoice data from PDF to Excel in n8n using GPT-4o-mini\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow scans a local folder of invoice PDF files, extracts structured header + line-item data using \u003cstrong\u003eOpenAI (gpt-4o-mini)\u003c\/strong\u003e, validates required fields and subtotal math, and outputs \u003cstrong\u003eper-invoice Excel files\u003c\/strong\u003e—while archiving PDFs into \u003cem\u003evalid\u003c\/em\u003e, \u003cem\u003einvalid\u003c\/em\u003e, or \u003cem\u003eerror\u003c\/em\u003e folders and generating a daily execution report.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRuns on a daily schedule\u003c\/strong\u003e and checks that n8n is self-hosted with filesystem access to your configured local directories.\u003c\/li\u003e\n  \u003cli\u003eCreates an initial \u003cstrong\u003eexecution-report Excel\u003c\/strong\u003e file to track totals.\u003c\/li\u003e\n  \u003cli\u003eReads each invoice PDF from the configured \u003cstrong\u003elocal input folder\u003c\/strong\u003e and extracts text from the document.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eHandles unreadable PDFs\u003c\/strong\u003e by routing them to the error workflow path.\u003c\/li\u003e\n  \u003cli\u003eCleans extracted text and sends it to \u003cstrong\u003eOpenAI (gpt-4o-mini)\u003c\/strong\u003e with a \u003cstrong\u003estrict JSON schema\u003c\/strong\u003e to extract invoice header fields and line items.\u003c\/li\u003e\n  \u003cli\u003eNormalizes the AI response, then \u003cstrong\u003evalidates required fields\u003c\/strong\u003e and checks \u003cstrong\u003eline-item\/subtotal consistency\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eFormats and writes results into an \u003cstrong\u003eExcel output per invoice\u003c\/strong\u003e in the local output folder.\u003c\/li\u003e\n  \u003cli\u003eRoutes each source PDF into \u003cstrong\u003evalid\u003c\/strong\u003e, \u003cstrong\u003einvalid\u003c\/strong\u003e, or \u003cstrong\u003eerror\u003c\/strong\u003e folders, and removes it from the input folder.\u003c\/li\u003e\n  \u003cli\u003eOverwrites the execution report with \u003cstrong\u003efinal counts\u003c\/strong\u003e and end time.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eConverting scanned or formatted invoice PDFs into consistent Excel spreadsheets for bookkeeping.\u003c\/li\u003e\n  \u003cli\u003eBatch processing daily invoice intake with automated validation to catch missing fields or incorrect totals.\u003c\/li\u003e\n  \u003cli\u003eMaintaining an auditable workflow by archiving PDFs based on extraction and validation results.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003en8n Community Edition\u003c\/strong\u003e self-hosted (local file access required)\u003c\/li\u003e\n  \u003cli\u003eBuilt with workflow nodes including \u003cstrong\u003eif\u003c\/strong\u003e, \u003cstrong\u003eset\u003c\/strong\u003e, \u003cstrong\u003ecode\u003c\/strong\u003e, \u003cstrong\u003emerge\u003c\/strong\u003e, and \u003cstrong\u003eswitch\u003c\/strong\u003e (plus \u003cstrong\u003esticky note\u003c\/strong\u003e for clarity)\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOpenAI (gpt-4o-mini)\u003c\/strong\u003e for structured JSON extraction with schema constraints\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46072075452595,"sku":"N8N-19810","price":45.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/1kjrFXc2QPM1bybF-Ioi3_N59vm3vy.png?v=1790067751","url":"https:\/\/buyflowscripts.com\/products\/invoice-pdf-to-excel-extraction-with-gpt-4o-mini-in-n8n","provider":"N8N Commerce","version":"1.0","type":"link"}