Gmail PDF Table Extract to Google Sheets (OpenAI + Slack) - n8n
Gmail PDF Table Extract to Google Sheets (OpenAI + Slack) - n8n
Regular price
£6.99
Regular price
£6.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 PDF Table Extract to Google Sheets (OpenAI + Slack) - n8n
Regular price
£6.99
Regular price
£6.99
Sale price
Unit price
/
per
Extract PDF tables from Gmail, verify totals, and auto-post line items to Google Sheets
This n8n workflow reads PDF attachments from incoming Gmail report emails, extracts the table using OpenAI, reconciles the math in plain JavaScript, and only writes to your Google Sheets “Line Items” when the sum matches the printed total—otherwise it flags the issue in Slack and logs it to “Needs Review”.
What this workflow does
- Triggers on new Gmail messages under a configured label and downloads the attachment for processing.
- Filters attachments to PDFs only, then converts each PDF into plain text.
-
Uses OpenAI with a structured output schema to extract:
- report title
- currency
- stated total (as printed in the PDF)
- all line-item rows from the PDF text
- Sums extracted line totals in JavaScript and compares them to the stated total using configurable absolute and percentage tolerances.
- If totals reconcile: splits the extracted rows into individual line items and appends them to the “Line Items” tab in Google Sheets.
- If totals do not reconcile (or no stated total exists): appends a summary row to the “Needs Review” tab and posts a mismatch alert to Slack.
Use cases
- Automatically capture invoice-like report line items received via Gmail into Google Sheets for bookkeeping.
- Reduce extraction errors by verifying totals instead of trusting model calculations.
- Create an operational review queue (“Needs Review”) and notify your team in Slack when reports don’t match.
Technical details
- Gmail trigger filtered by label ID/name; processes PDF attachments.
- PDF to text conversion step.
- OpenAI structured extraction for title, currency, stated total, and line-item rows.
- JavaScript total reconciliation with absolute/percentage tolerances.
- Google Sheets writes to “Line Items” or “Needs Review”.
- Slack mismatch alerts.
- Implemented with nodes including if, set, code, slack, filter, split out.
