Templates / Extract invoice data from Gmail PDFs to Google Sheets with OpenAI and Slack

Extract invoice data from Gmail PDFs to Google Sheets with OpenAI and Slack

Ready for 3.0

by Abhishek Gawade ✓ · 25 views · created 2026-06-13 · Invoice Processing, AI Summarization

Ready for 3.0. This template uses no nodes that n8n 3.0 removes. No removed nodes, versions or helpers found. Static check, last run 2026-10-19.

Worth a look

Nodes used (8)

GmailBasic LLM ChainOpenAI Chat ModelStructured Output ParserGoogle SheetsSlack

What it does

Quick Overview This workflow monitors Gmail for emails with PDF attachments, extracts invoice fields with OpenAI, logs the results to a Google Sheets bookkeeping spreadsheet, and posts high-value invoices to Slack for approval. How it works 1. Triggers every minute when Gmail finds a new email matching the search query and downloads its attachments. 2. Extracts text from the first PDF attachment in the email. 3. Sends the extracted text to OpenAI (gpt-4o-mini) to return structured invoice data (vendor, dates, amounts, currency, category, and summary) as JSON. 4. Appends the extracted invoice fields to a Google Sheets worksheet and marks the entry as Unpaid with the current received timestamp. 5. Checks whether the invoice total is greater than or equal to 1000. 6. Posts a Slack message to a selected channel to request approval for invoices that meet the high-value threshold. Setup 1. Connect your Gmail, OpenAI, Google Sheets, and Slack credentials in n8n. 2. Update the Gmail search query in the Gmail trigger to target the invoice emails you want to process (for example, by label, sender, or subject). 3. Replace YOURGOOGLESHEETID with your spreadsheet ID and ensure the target sheet has columns matching Vendor, Invoice , Invoice Date, Due Date, Currency, Category, Tax, Total, Status, and Received. 4. Set the Slack channel to post into and adjust the approval threshold amount (currently 1000) to match your policy.

View the original on n8n.io → Check your own copy

Get the weekly “what broke” email

New templates, newly broken ones, and n8n release changes. One short email a week.

Form not loading? Subscribe here.