Extract PDF report tables into Google Sheets with Gmail, OpenAI and Slack
Ready for 3.0What this workflow does
This AI workflow has 15 nodes and runs on Gmail events. Along the way it connects Gmail, OpenAI Chat Model, Google Sheets and Slack.
How it runs
Trigger: On Gmail events.
- Report Settings (Edit Fields (Set)): sets or maps fields
- Only PDF Attachments (Filter): keeps only the items that match a condition
- PDF To Text (Extract from File): extracts data from a file
- Extract Report Table (Basic LLM Chain): sends a prompt to an LLM, with model: Extraction Model; output parser: Report Schema
- Reconcile Totals (Code): runs custom JavaScript code
- Did It Reconcile? (If): checks a condition and branches into true / false
- Split Line Items (Split Out): splits a list into separate items
- Prepare Mismatch Alert (Edit Fields (Set)): sets or maps fields
- Flatten Line Item (Edit Fields (Set)): sets or maps fields
- Flag For Review (Google Sheets): uses Google Sheets
…plus 2 more steps. See the full node list below.
Services it uses
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (12)
- Gmail Trigger
n8n-nodes-base.gmailTrigger - Edit Fields (Set)
n8n-nodes-base.set - Filter
n8n-nodes-base.filter - Extract from File
n8n-nodes-base.extractFromFile - Basic LLM Chain
@n8n/n8n-nodes-langchain.chainLlm - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Structured Output Parser
@n8n/n8n-nodes-langchain.outputParserStructured - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - Split Out
n8n-nodes-base.splitOut - Google Sheets
n8n-nodes-base.googleSheets - Slack
n8n-nodes-base.slack
From the author
Quick overview I stopped trusting a model to add up its own numbers, so this one checks its work in plain code. It reads the table off a PDF, sums the line items in JavaScript, and only writes to your books when that sum matches the printed total. How it…