Process emailed PDF invoices into QuickBooks bills with OpenAI

AI Invoice Processor for QuickBooks - Email to Bill with PDF Attachment

Automatically processes vendor invoices received by email, creates QuickBooks bills with full details, and attaches the original PDF.

Who is this for?

Small/medium businesses using QuickBooks Online Bookkeepers processing 20+ invoices/month Accounting firms managing multiple clients Anyone tired of manually entering invoice data into QuickBooks

What it does

Monitors Gmail for new emails with PDF attachments (every 15 minutes) Extracts text from the PDF using n8n's built-in PDF parser AI classification - determines if the PDF is actually an invoice (skips receipts, contracts, etc.) AI data extraction - pulls structured data: vendor name, invoice number, amount, currency, dates, and line items Vendor lookup - searches QuickBooks for the vendor by name Creates a Bill in QuickBooks with all extracted data (amount, description, dates) Attaches the original PDF to the bill for reference Sends confirmation email back to the sender with bill details

Error handling

Not an invoice?** Silently skipped - no noise AI can't extract valid data?** Email sent to AP team with error details Vendor not found in QuickBooks?** Email sent to AP team with vendor name and action steps

Setup (5 minutes)

Prerequisites Gmail account (OAuth2) OpenAI API key QuickBooks Online account (OAuth2)

Steps

Import the workflow into your n8n instance Connect credentials: Gmail OAuth2 OpenAI API QuickBooks OAuth2 Edit the Config node with your values: realmId - your QuickBooks Company ID (Settings → Account) apTeamEmail - where error notifications go defaultExpenseAccountId - your QB expense account ID (see below) Activate the workflow

How to find your Expense Account ID

Log in to QuickBooks Online Go to Settings (gear icon) → Chart of Accounts Find an expense account (e.g. "Office Supplies", "Professional Services") Hover → click View register (or Run report) Look at the URL for accountId=XX or account=XX That number is your defaultExpenseAccountId

Sandbox vs Production

If using QuickBooks Sandbox, update the Upload PDF to Bill node URL from: https://quickbooks.api.intuit.com/v3/company/... to: https://sandbox-quickbooks.api.intuit.com/v3/company/...

Technical details

AI extraction schema

The AI extracts these fields from each invoice PDF:

| Field | Type | Example | |-------|------|---------| | is_invoice | boolean | true | | vendor_name | string | "Acme Corp" | | invoice_number | string | "INV-2024-001" | | amount | number | 1500.00 | | currency | string | "USD" | | due_date | string | "2024-12-31" | | txn_date | string | "2024-12-01" | | line_items | array | [{description, amount, quantity}] |

Binary data flow

PDF binary data is lost after the AI extraction step (LangChain nodes don't preserve binary). The attachment pipeline solves this by referencing the binary from the Config node using $('Config').item.binary.attachment_0 - a named reference that works regardless of the connection path.

Force Inline Binary (n8n v2 quirk)

n8n v2 stores binary data as database streams. QuickBooks' /upload API requires Content-Length in multipart uploads, which streams can't provide. A Code node converts binary streams to inline base64 before upload.

Nodes used

Gmail Trigger (polling) Extract from File (PDF) Information Extractor (LangChain + OpenAI) QuickBooks Online (vendor search, bill creation) HTTP Request (PDF upload to bill) Gmail (confirmation & error emails) Code nodes (data transformation) IF nodes (routing logic)

Limitations

Single line item per bill** - the native QuickBooks node supports only one line item. All extracted line items are combined into the description field with invoice number.

0
Downloads
1
Views
8.72
Quality Score
intermediate
Complexity
Author:Codez & AI(View Original →)
Created:3/23/2026
Updated:3/31/2026

🔒 Please log in to import templates to n8n and favorite templates

Workflow Visualization

Loading...

Preparing workflow renderer

Comments (0)

Login to post comments