AutomationFlowsAI & RAG › Extract Data From PDF Reports with Gmail, Ocr, Google Sheets and Openai…

Extract Data From PDF Reports with Gmail, Ocr, Google Sheets and Openai…

Original n8n title: Extract Data From PDF Reports with Gmail, Ocr, Google Sheets and Openai Gpt-4.1-mini

ByHyrum Hurst @hyrum-hurst on n8n.io

Consultants, agencies, financial analysts, and project managers who regularly receive client PDFs, invoices, or reports.

Event trigger★★★★☆ complexityAI-powered22 nodesGmail TriggerAgentOpenAI ChatOutput Parser StructuredGoogle SheetsSlack
AI & RAG Trigger: Event Nodes: 22 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow corresponds to n8n.io template #12961 — we link there as the canonical source.

This workflow follows the Agent → Gmail Trigger recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "0Fti34wCcWqjhN38",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "PDF Report Data Extraction and Classification Automation",
  "tags": [],
  "nodes": [
    {
      "id": "faecb5ae-a628-4321-94de-58bcc42b7585",
      "name": "New PDF Email Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        448,
        32
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "911f22dd-b863-4590-8451-2a7fe082add7",
      "name": "Workflow Configuration",
      "type": "n8n-nodes-base.set",
      "position": [
        672,
        32
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "120a3000-0191-4b19-acb3-85d5b991d366",
      "name": "Check PDF Attachment Exists",
      "type": "n8n-nodes-base.if",
      "position": [
        912,
        32
      ],
      "parameters": {},
      "typeVersion": 2.3
    },
    {
      "id": "e577ad39-928f-4b3c-9cf1-505592b0430a",
      "name": "Extract Text from PDF",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1120,
        -64
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "55085b36-7896-4200-b502-64cd16f26d9a",
      "name": "Parse Key Fields with AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1344,
        -64
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "7b74d7a3-f37f-428d-909a-54708bfc40cc",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1352,
        160
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "fbe3a9c0-c972-4f22-99a3-98f88c9b9577",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1480,
        160
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "8e952ef4-0d11-464f-8524-6d8ea60501a0",
      "name": "Normalize Extracted Data",
      "type": "n8n-nodes-base.set",
      "position": [
        1696,
        -64
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "736dbec4-a7a3-49ac-96cc-4936b6e68930",
      "name": "Classify Document Type",
      "type": "n8n-nodes-base.switch",
      "position": [
        1920,
        -96
      ],
      "parameters": {},
      "typeVersion": 3.4
    },
    {
      "id": "5854eb50-5cc4-48ac-8b1c-b8e753bc4a42",
      "name": "Store Invoice Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2208,
        -256
      ],
      "parameters": {},
      "typeVersion": 4.7
    },
    {
      "id": "10c41b28-3232-4461-b401-e651ba17222d",
      "name": "Summarize Report with AI",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2144,
        232
      ],
      "parameters": {},
      "typeVersion": 3
    },
    {
      "id": "24a137bc-60bc-4339-932e-134a71a6046b",
      "name": "OpenAI Chat Model for Summary",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2216,
        456
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "ded393e5-0186-4512-86d6-a60bcbc43a8d",
      "name": "Notify Contract Team",
      "type": "n8n-nodes-base.slack",
      "position": [
        2208,
        -64
      ],
      "parameters": {},
      "typeVersion": 2.4
    },
    {
      "id": "751424f0-bee1-48ba-a4c2-f50ba0732877",
      "name": "Store All Extracted Data",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2496,
        -160
      ],
      "parameters": {},
      "typeVersion": 4.7
    },
    {
      "id": "0683c1c1-63ae-4444-86ab-54b2ddebb4f2",
      "name": "Send Summary Notification",
      "type": "n8n-nodes-base.slack",
      "position": [
        2720,
        -160
      ],
      "parameters": {},
      "typeVersion": 2.4
    },
    {
      "id": "ab625317-7f5f-4e24-b16c-fbb3a53bdbea",
      "name": "Error Handler and Logger",
      "type": "n8n-nodes-base.code",
      "position": [
        1120,
        128
      ],
      "parameters": {},
      "typeVersion": 2
    },
    {
      "id": "d9218bc4-05bc-47cd-a952-7ba4a73b04e4",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -128,
        -144
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "ae1b8a71-34a6-46aa-9868-c29c2c513bef",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        352,
        -144
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "58183e1b-2c70-4909-b4c0-5c5fdc3bb07a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1312,
        -144
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "4d7730df-fee2-4078-8891-c4605cf83b19",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        896,
        -144
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "25d928e4-e431-4293-b487-e561019db775",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        176
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "d2f46e08-157b-48e5-9164-7f550154694e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2080,
        -336
      ],
      "parameters": {
        "content": ""
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "6a1616d1-adfa-416f-87b0-a9a1fc1e16e2",
  "connections": {
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Parse Key Fields with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Store Invoice Data": {
      "main": [
        [
          {
            "node": "Store All Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notify Contract Team": {
      "main": [
        [
          {
            "node": "Store All Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Text from PDF": {
      "main": [
        [
          {
            "node": "Parse Key Fields with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "New PDF Email Trigger": {
      "main": [
        [
          {
            "node": "Workflow Configuration",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Classify Document Type": {
      "main": [
        [
          {
            "node": "Store Invoice Data",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Summarize Report with AI",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notify Contract Team",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Workflow Configuration": {
      "main": [
        [
          {
            "node": "Check PDF Attachment Exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize Extracted Data": {
      "main": [
        [
          {
            "node": "Classify Document Type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse Key Fields with AI": {
      "main": [
        [
          {
            "node": "Normalize Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Store All Extracted Data": {
      "main": [
        [
          {
            "node": "Send Summary Notification",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Parse Key Fields with AI",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Summarize Report with AI": {
      "main": [
        [
          {
            "node": "Store All Extracted Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check PDF Attachment Exists": {
      "main": [
        [
          {
            "node": "Extract Text from PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Handler and Logger",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model for Summary": {
      "ai_languageModel": [
        [
          {
            "node": "Summarize Report with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Consultants, agencies, financial analysts, and project managers who regularly receive client PDFs, invoices, or reports.

Source: https://n8n.io/workflows/12961/ — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow automates invoice processing directly from your email inbox.

Gmail Trigger, HTTP Request, Agent +5
AI & RAG

Gmail users report spending significant time manually sorting email, so this tool helps alleviate that burden. Gmail Trigger monitors unread emails every 2 minutes Once an email arrives, the content i

OpenAI Chat, Output Parser Structured, Agent +4
AI & RAG

Streamline your HR recruitment process with this intelligent automation that reads candidate emails and resumes, analyzes them using GPT-4, and automatically shortlists or rejects applicants based on

Gmail, Gmail Trigger, HTTP Request +7
AI & RAG

AI-Powered Invoice Processing from Gmail to Google Sheets with Slack Approval This workflow completely automates your invoice processing pipeline. It triggers when a new invoice email arrives in Gmail

Gmail Trigger, Gmail, Agent +4
AI & RAG

Activate this workflow once and it monitors your Gmail inbox every minute automatically. Every incoming email is scanned for complaint keywords — and if a complaint is detected, GPT-4o-mini scores its

Gmail Trigger, Agent, OpenAI Chat +3