Templates / Check supplier invoices from Gmail using OpenAI, Google Sheets and Slack

Check supplier invoices from Gmail using OpenAI, Google Sheets and Slack

Ready for 3.0

by Hamza Jamal Janjua · 5 views · created 2026-09-15 · 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 (11)

GmailOpenAI Chat ModelInformation ExtractorGoogle SheetsSlack

What it does

Quick overview Watches a Gmail label for supplier invoice PDFs, reads the fields with OpenAI, then runs eight checks against supplier, purchase order and ledger data in Google Sheets. Clean invoices post to the ledger, large ones go to Slack for sign off, and failures are sent back to the supplier. How it works 1. Triggers when a new email with attachments arrives in Gmail under a specified label. 2. Filters the email attachments to keep only PDFs and extracts the PDF text. 3. Uses OpenAI to convert the invoice text into structured fields like supplier, invoice number, PO number, dates, currency, totals, and line items. 4. Loads supplier records, open purchase orders, and already-posted invoices from Google Sheets and applies checks for duplicates, totals/tax validity, PO matching, and invoice date sanity. 5. If all checks pass and the amount is within the approval limit, appends the invoice record to the Google Sheets Ledger. 6. If all checks pass but the amount exceeds the approval limit, posts a Slack message to request human sign-off. 7. If any check fails, appends the invoice to the Google Sheets Exceptions sheet and emails the supplier with a numbered list of issues. Setup 1. Connect Gmail Trigger credentials and set the Gmail label ID where supplier invoices arrive, ensuring attachments are enabled. 2. Add an OpenAI credential for the extraction step. 3. Connect Google Sheets credentials and replace the spreadsheet URL placeholders, ensuring the sheet names SupplierMaster, OpenPurchaseOrders, Ledger, and Exceptions exist with appropriate columns. 4. Connect Slack credentials and set the accounts payable channel name/ID for approval requests and error alerts. 5. Populate SupplierMaster (including suppliername, supplieremail, porequired, defaultapprover) and OpenPurchaseOrders (including ponumber, remainingvalue, currency, approveremail) so the checks can run correctly. Requirements - A Gmail account receiving supplier invoices, with a label you can filter on. An OpenAI credential for the extraction step. One Google Sheets spreadsheet with four tabs: SupplierMaster (suppliername, supplieremail, defaultapprover, porequired), OpenPurchaseOrders (ponumber, remainingvalue, currency, approveremail), Ledger and Exceptions. A Slack workspace and a channel for accounts payable. Customization - Every threshold sits at the top of the Code node: the rounding tolerance on subtotal plus tax, how far above a purchase order an invoice may go, how old an invoice may be, the approval limit, and the valid tax rates, which ship set to 0 and 5 for the UAE. Change VALIDTAXRATES for your country. Add or remove checks by pushing to the failures array, and anything you push becomes a line in the email the supplier receives. Swap Slack for Teams or email, and swap the Google Sheets nodes for your accounting system's own nodes.

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.