Gmail to Google Sheets Invoice OCR with OpenAI GPT-4o (n8n)
Gmail to Google Sheets Invoice OCR with OpenAI GPT-4o (n8n)
Regular price
£30.99
Regular price
£30.99
Sale price
Unit price
/
per
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
Couldn't load pickup availability
🔥
128+ Sold
Popular with n8n builders
âš¡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
Gmail to Google Sheets Invoice OCR with OpenAI GPT-4o (n8n)
Regular price
£30.99
Regular price
£30.99
Sale price
Unit price
/
per
Turn PDF invoice emails into structured rows in Google Sheets—automatically
This n8n workflow polls your Gmail inbox for PDF invoice/receipt attachments, extracts the text, uses OpenAI GPT-4o to parse key invoice fields into strict JSON, and then appends the results to Google Sheets as a new row—ready for reporting, reconciliation, and downstream automation.
What this workflow does
-
Polls Gmail every 15 minutes for messages matching the query:
has:attachment filename:pdf (invoice OR receipt). - Downloads the first PDF attachment found in each matching email and errors if no PDF is present.
- Extracts text from the PDF attachment.
- Sends the extracted text to OpenAI Chat Completions using gpt-4o-mini and requests a strict JSON object containing: vendor, invoice number, dates, currency, and amounts.
-
Parses the OpenAI response, adds the sender email address and a processed timestamp, and normalizes missing fields to
null. - Appends a new row to Google Sheets with invoice fields and email metadata.
Use cases
- Accounts payable teams who receive invoices by email and want an always-updated Google Sheets ledger.
- SaaS operators consolidating recurring vendor billing into a single spreadsheet for visibility.
- Automation engineers building invoice ingestion pipelines without manual copy/paste from PDFs.
Technical details
- Gmail Trigger (with a configurable search query and a 15-minute polling interval).
- Extract from file step for PDF text extraction.
-
HTTP Request to
https://api.openai.com/v1/chat/completionsusing an OpenAI API credential. - OpenAI Chat Completions prompt returns strict JSON.
- Google Sheets integration to append rows.
Setup checklist
- Connect Gmail credentials to the Gmail Trigger and ensure you can access the invoice emails mailbox.
- Add OpenAI API credentials for the HTTP request to the Chat Completions endpoint.
- Connect Google Sheets and ensure your sheet has matching columns: Vendor, Invoice #, Date, Due Date, Currency, Subtotal, Tax, Total, Email From, Processed At.
