PO approvals were stuck in Gmail — built this workflow to extract line items, route approvals, and flag urgency

Small note: this is an updated implementation-focused share of the purchase order workflow, with more detail on Gmail attachment handling, approval thresholds, urgency logic, Sheets output, and Slack notifications.

Purchase orders often arrive as email attachments, but approval usually depends on more than the PO number.

Procurement needs the vendor, required date, line items, subtotal, shipping, tax, grand total, payment terms, and whether the delivery date is urgent.

If that all sits in Gmail until someone opens the PDF, the approval process starts late.

So I built an n8n workflow that watches Gmail for PO attachments, extracts the PO data, calculates approval level by amount, flags urgency by required date, logs everything to Google Sheets, and sends a Slack summary to procurement.

What it does

Gmail receives a PO email → n8n downloads the attachment → PDF Vector extracts purchase order fields → Code node calculates approval level and urgency → Google Sheets logs the PO → Slack notifies procurement

The workflow checks Gmail every minute and downloads attachments using the attachment_ binary prefix.

Good fit for:

  • Procurement teams

  • Finance departments

  • Operations managers

  • Small businesses approving vendor purchases from email

For sensitive vendor pricing, finance, or procurement data, I recommend self-hosted n8n so workflow executions and attachments stay under your own infrastructure.

What gets extracted

The PDF Vector node extracts flat fields from the PO attachment:

  • PO number

  • Order date

  • Required date

  • Vendor name

  • Vendor address

  • Vendor contact

  • Vendor email

  • Vendor phone

  • Ship-to name

  • Ship-to address

  • Ship-to attention

  • Bill-to name

  • Bill-to address

  • Line items list

  • Line item count

  • Subtotal

  • Shipping cost

  • Tax

  • Grand total

  • Payment terms

  • Shipping method

  • Notes

The line items list is stored as one text field for reliable Sheets output.

Example:


4 x Dell monitors @ 240.00 = 960.00; 2 x docking stations @ 180.00 = 360.00

Approval logic

The Code node assigns approval level based on grand total.

Current thresholds:


< $1,000 → Auto-Approve

$1,000 to $4,999 → Manager Approval

$5,000 to $24,999 → Director Approval

≥ $25,000 → VP/CFO Approval

This is routing logic, not final approval. You can add approval nodes, manual review, or an external procurement system after this step.

Urgency logic

The Code node compares the required date to today.

Current logic:


Required in 3 days or less → Urgent

Required in 7 days or less → High

Otherwise → Normal

This makes it easier to see which POs need attention before a delivery deadline is missed.

What lands in Slack

The procurement channel receives a summary like this:


📦 New Purchase Order Received

Tracking: PO-MA8K2F9

PO Number: PO-2026-0148

Vendor: Acme Office Supply

Line Items (2):

4 x Dell monitors @ 240.00 = 960.00; 2 x docking stations @ 180.00 = 360.00

Total: $1,462.00

Required By: 2026-05-12

Approval Required: Manager Approval

Urgency: High

What lands in Google Sheets

The workflow appends one row per purchase order.

Headers:


Tracking ID | PO Number | Vendor | Order Date | Required Date | Line Items | Subtotal | Shipping | Tax | Grand Total | Approval Level | Urgency | Status | Received Date

Example row:


PO-MA8K2F9 | PO-2026-0148 | Acme Office Supply | 2026-05-08 | 2026-05-12 | 2 | 1320 | 40 | 102 | 1462 | Manager Approval | High | Pending Approval | 2026-05-08

Setup

You’ll need:

  • Gmail account where PO emails arrive

  • Google Sheets spreadsheet for the PO tracker

  • n8n instance

  • PDF Vector account

  • Gmail credential in n8n

  • Google Sheets credential in n8n

  • Slack credential in n8n

Download

Workflow JSON:

Purchase-order-processor.json

Full workflow collection:

khanhduyvt0101/workflows


Setup Guide

Step 1: Get your PDF Vector API key

Create an account at pdfvector.com.

The free tier includes 100 credits/month, enough to test with sample purchase orders.

Step 2: Create your Google Sheet

Create a Sheet with this header row:


Tracking ID | PO Number | Vendor | Order Date | Required Date | Line Items | Subtotal | Shipping | Tax | Grand Total | Approval Level | Urgency | Status | Received Date

Step 3: Import the workflow

In n8n:


Workflows → Import from File → select JSON

Step 4: Configure Gmail

Gmail Trigger

  • Connect Gmail OAuth2

  • Keep spam/trash excluded

  • Add Gmail filters if needed

Example Gmail filter:


has:attachment subject:(purchase order OR PO)

Get a message

  • Downloads attachments

  • Uses the attachment_ prefix

Step 5: Configure PDF extraction

PDF Vector - Extract PO

  • Add your PDF Vector credential

  • Input type: file

  • Binary property: attachment_0

  • Keep the schema unless you need more fields

Step 6: Configure routing logic

Process PO

This Code node creates:

  • tracking ID

  • formatted grand total

  • approval level

  • urgency

  • days until required date

Edit thresholds here if your procurement rules are different.

Step 7: Configure outputs

Log to PO Tracker

  • Connect Google Sheets

  • Select your spreadsheet

  • Map the headers

Notify Procurement

  • Connect Slack

  • Select the procurement or finance channel

Step 8: Test with different PO amounts

Test with:

  • one PO under $1,000

  • one PO above $1,000

  • one PO above $5,000

  • one PO above $25,000

  • one PO required within 3 days

  • one PO required within 7 days

Accuracy

This workflow is usually strongest on:

  • PO number

  • Vendor name

  • Order date

  • Required date

  • Grand total

  • Payment terms

Fields that need more review:

  • Complex line-item tables

  • Multiple ship-to locations

  • Split shipping charges

  • Tax-exempt POs

  • Handwritten or stamped notes

For procurement workflows, keep a human approval step before issuing payment or committing funds.

Cost

Structured extraction uses credits per page.

Simple estimate:


1-page PO ≈ 3 credits

100 free credits/month ≈ around 30 single-page POs for testing

Multi-page POs with long line-item tables will use more credits.

Customizing it

Change approval thresholds

Edit the Code node.

Example:


< $500 → Auto-Approve

$500-$2,499 → Manager

$2,500-$9,999 → Director

$10,000+ → CFO

Add approval buttons

Add Slack interactive approval or connect to your procurement system.

Add vendor validation

Look up vendor name in a Google Sheets vendor database before routing.

Add duplicate PO detection

Check whether the PO number already exists in the tracker before appending a new row.

Add exception routing

Route POs to a Needs Review tab when:


PO number is missing

grand total is 0

required date is missing

vendor is unknown

line items are not itemized


Helpful links:

PDF Vector n8n integration

Full workflow collection

What procurement rule would you add first: duplicate PO detection, vendor validation, or Slack approval buttons?

2 Likes

Hi @Truong, :waving_hand: I really like your work on this workflow.

The current date based urgency logic is solid and very practical; using required date thresholds to mark PO urgency keeps the flow simple and easy to follow. For a first version, that is exactly the kind of rule that works well.

I think fuzzy logic could be a useful next step if you want richer prioritization signals. In my own :backhand_index_pointing_right: fuzzy-logic topic, I showed how n8n can move from simple linear scoring to rule-based reasoning, and how the model can be extended with more inputs like risk, SLA, and customer tier, plus more granular membership functions.

So for this workflow, you could keep the current urgency logic as the baseline, and later evolve it with extra parameters such as PO amount, vendor criticality, payment terms, and delivery risk. That would make the urgency decision more nuanced while still staying explainable.

Great work; this is a very clean and practical implementation.

2 Likes

Thanks you very much!!

1 Like