AutomationFlowsAI & RAG › Extract Structured Invoice Data From Jotform Pdfs with Gpt-4.1-mini & Sheets

Extract Structured Invoice Data From Jotform Pdfs with Gpt-4.1-mini & Sheets

ByRanjan Dailata @ranjancse on n8n.io

This workflow is designed for Finance teams, accounting professionals, and automation engineers.

Webhook trigger★★★★☆ complexityAI-powered19 nodesInformation ExtractorHTTP RequestOutput Parser StructuredChain LlmOpenAI ChatRead Write FileGoogle Sheets
AI & RAG Trigger: Webhook Nodes: 19 Complexity: ★★★★☆ AI nodes: yes Added:
Extract Structured Invoice Data From Jotform Pdfs with Gpt-4.1-mini & Sheets — n8n workflow card showing Information Extractor, HTTP Request, Output Parser Structured integration

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

This workflow follows the Chainllm → Google Sheets 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": "QvIVxAgboRsZMMr0",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Structured Invoice Data Extraction from JotForm PDFs via Open AI GPT-4.1-mini",
  "tags": [
    {
      "id": "Kujft2FOjmOVQAmJ",
      "name": "Engineering",
      "createdAt": "2025-04-09T01:31:00.558Z",
      "updatedAt": "2025-04-09T01:31:00.558Z"
    },
    {
      "id": "ddPkw7Hg5dZhQu2w",
      "name": "AI",
      "createdAt": "2025-04-13T05:38:08.053Z",
      "updatedAt": "2025-04-13T05:38:08.053Z"
    }
  ],
  "nodes": [
    {
      "id": "bcd1e88b-4435-4862-960e-86f284884681",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -544,
        -32
      ],
      "parameters": {
        "path": "b3a65dd9-8203-4aff-8005-80d98fb4c030",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    },
    {
      "id": "84b85e47-b3aa-4c61-85ce-c17aba383b8e",
      "name": "Formatted Structured Data Extract",
      "type": "@n8n/n8n-nodes-langchain.informationExtractor",
      "position": [
        -352,
        -32
      ],
      "parameters": {
        "text": "= Extract Structured Information in JSON from the provided invoice raw request {{ $('Webhook').item.json.body.rawRequest }}",
        "options": {},
        "schemaType": "fromJson",
        "jsonSchemaExample": "{\n  \"formSubmission\": {\n    \"id\": \"252920932663460\",\n    \"source\": \"form\",\n    \"submittedAt\": \"2025-10-20T11:45:35.950Z\",\n    \"timeToSubmitSeconds\": 20,\n    \"eventId\": \"1760940191615_252920932663460_6BZ73Ag\"\n  },\n  \"user\": {\n    \"name\": {\n      \"first\": \"Ranjan\",\n      \"last\": \"Dailata\"\n    },\n    \"email\": \"user@example.com\"\n  },\n  \"invoice\": {\n    \"number\": \"INV-3337\",\n    \"date\": {\n      \"month\": \"\",\n      \"day\": \"\",\n      \"year\": \"\"\n    },\n    \"description\": \"Sample Invoice\",\n    \"attachments\": [\n      {\n        \"filename\": \"PDF-Invoice-Sample.pdf\",\n        \"url\": \"https://www.jotform.com/uploads/ranjancse/252920932663460/6367495377218625724/PDF-Invoice-Sample.pdf\",\n        \"fileServer\": \"jotformfs-e4f4ece4d0a90#019a0038-65e1-79f6-bdb5-c9281000db56\"\n      }\n    ]\n  },\n  \"system\": {\n    \"uploadServerUrl\": \"https://upload.jotform.com/upload\",\n    \"eventObserverEnabled\": true,\n    \"validatedFields\": {\n      \"new\": 1\n    },\n    \"buildDate\": \"1760940189728\",\n    \"jsExecutionTracker\": {\n      \"buildDate\": \"1760940189728\",\n      \"initStarted\": \"1760940191614\",\n      \"validatorCalled\": \"1760940191680\",\n      \"validatorMounted\": false,\n      \"initComplete\": \"1760940191684\",\n      \"intervalComplete\": \"1760940212688\",\n      \"onSubmitFired\": \"1760940335932\",\n      \"validationPassed\": \"1760940335944\",\n      \"formSubmitted\": \"1760940335950\"\n    }\n  }\n}\n"
      },
      "typeVersion": 1.2
    },
    {
      "id": "f7f77bb3-eb70-4000-aace-061d022e2882",
      "name": "Download Invoice",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        0,
        -32
      ],
      "parameters": {
        "url": "={{ $json.output.invoice.attachments[0].url }}",
        "options": {
          "redirect": {
            "redirect": {}
          },
          "response": {
            "response": {
              "responseFormat": "file",
              "outputPropertyName": "=PDF-Invoice-Sample.pdf"
            }
          }
        },
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "headerParameters": {
          "parameters": [
            {}
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        },
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "cc1a28b8-a287-43c3-9bb3-118a89570562",
      "name": "Extract from File",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        416,
        -32
      ],
      "parameters": {
        "options": {},
        "operation": "pdf",
        "binaryPropertyName": "={{ $('Write File from Disk for Inbound Invoice Processing').item.binary['PDF-Invoice-Sample.pdf']}}"
      },
      "typeVersion": 1
    },
    {
      "id": "e9a4d6af-2efc-4d6b-8f72-5b49f60181ca",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        736,
        160
      ],
      "parameters": {
        "autoFix": true,
        "schemaType": "manual",
        "inputSchema": "{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"title\": \"Invoice\",\n  \"type\": \"object\",\n  \"properties\": {\n    \"invoiceId\": {\n      \"type\": \"string\",\n      \"description\": \"Unique invoice identifier\"\n    },\n    \"invoiceNumber\": {\n      \"type\": \"string\",\n      \"description\": \"Human-readable invoice number (e.g. INV-2025-001)\"\n    },\n    \"invoiceDate\": {\n      \"type\": \"string\",\n      \"format\": \"date\",\n      \"description\": \"Invoice issue date\"\n    },\n    \"dueDate\": {\n      \"type\": \"string\",\n      \"format\": \"date\",\n      \"description\": \"Payment due date\"\n    },\n    \"company\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"name\": { \"type\": \"string\" },\n        \"address\": { \"type\": \"string\" },\n        \"email\": { \"type\": \"string\" },\n        \"phone\": { \"type\": \"string\" },\n        \"taxId\": { \"type\": \"string\" }\n      },\n      \"required\": [\"name\"]\n    },\n    \"client\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"name\": { \"type\": \"string\" },\n        \"address\": { \"type\": \"string\" },\n        \"email\": { \"type\": \"string\" },\n        \"phone\": { \"type\": \"string\" }\n      },\n      \"required\": [\"name\"]\n    },\n    \"items\": {\n      \"type\": \"array\",\n      \"description\": \"Line items billed on the invoice\",\n      \"items\": {\n        \"type\": \"object\",\n        \"properties\": {\n          \"description\": { \"type\": \"string\" },\n          \"quantity\": { \"type\": \"number\" },\n          \"unitPrice\": { \"type\": \"number\" },\n          \"total\": { \"type\": \"number\" },\n          \"taxRate\": { \"type\": \"number\" }\n        },\n        \"required\": [\"description\", \"quantity\", \"unitPrice\"]\n      }\n    },\n    \"subTotal\": {\n      \"type\": \"number\",\n      \"description\": \"Total before tax and discounts\"\n    },\n    \"taxAmount\": {\n      \"type\": \"number\",\n      \"description\": \"Total tax amount applied\"\n    },\n    \"discount\": {\n      \"type\": \"number\",\n      \"description\": \"Discount applied to invoice\"\n    },\n    \"totalAmount\": {\n      \"type\": \"number\",\n      \"description\": \"Final amount due\"\n    },\n    \"currency\": {\n      \"type\": \"string\",\n      \"description\": \"Currency code (e.g. USD, EUR, INR)\"\n    },\n    \"notes\": {\n      \"type\": \"string\",\n      \"description\": \"Optional notes or terms\"\n    },\n    \"payment\": {\n      \"type\": \"object\",\n      \"properties\": {\n        \"method\": { \"type\": \"string\", \"description\": \"Payment method (Bank, Card, etc.)\" },\n        \"status\": { \"type\": \"string\", \"description\": \"paid, pending, overdue\" },\n        \"transactionId\": { \"type\": \"string\" },\n        \"paymentDate\": { \"type\": \"string\", \"format\": \"date\" }\n      }\n    },\n    \"attachments\": {\n      \"type\": \"array\",\n      \"description\": \"Links to attached invoice PDFs or receipts\",\n      \"items\": {\n        \"type\": \"string\",\n        \"format\": \"uri\"\n      }\n    }\n  }\n}\n"
      },
      "typeVersion": 1.3
    },
    {
      "id": "c60bd005-d03e-4053-93a1-7137c90b8e80",
      "name": "Structured Data Extract",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        640,
        -32
      ],
      "parameters": {
        "text": "=Parse the below invoice info into a structured data\n\n{{ $json.text }}",
        "batching": {},
        "promptType": "define",
        "hasOutputParser": true
      },
      "retryOnFail": true,
      "typeVersion": 1.7,
      "alwaysOutputData": false
    },
    {
      "id": "2d0f93f5-6372-4c2c-97a0-61275648fc58",
      "name": "OpenAI Chat Model for Structured Data",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        576,
        176
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "48d81c63-ed97-4229-a63d-ad1a2a8959ae",
      "name": "OpenAI Chat Model for Output Parser",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        672,
        368
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a54f0c84-82ca-439e-8cd8-86dabe04f69b",
      "name": "OpenAI Chat Model for Structured Data Formatted Content",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -352,
        176
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "a21275f7-fc1b-47ab-ba6a-06bcde58875e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -432
      ],
      "parameters": {
        "color": 7,
        "width": 352,
        "height": 272,
        "content": "![Logo](https://www.jotform.com/resources/assets/logo-nb/min/jotform-logo-white-400x200.png)\n\nUses OpenAI gpt-4.1-mini for structured data extraction of the invoice PDF content"
      },
      "typeVersion": 1
    },
    {
      "id": "569de30c-835b-4ed3-aa7c-21052f4c06c9",
      "name": "Write File from Disk for Inbound Invoice Processing",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        208,
        -32
      ],
      "parameters": {
        "options": {},
        "fileName": "=c:\\\\PDF-Invoice-Sample.pdf",
        "operation": "write",
        "dataPropertyName": "={{ $json.output.invoice.attachments[0].filename }}"
      },
      "typeVersion": 1
    },
    {
      "id": "9f3662ac-82cf-48fd-b04e-979d8d4d9310",
      "name": "Append or update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1120,
        144
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [
            {
              "id": "output",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "output",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [
            "output"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WaQUR9Q32uKLbbu77CrvWhM2I_3NXEsxT0RDMGq-Dm0/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1WaQUR9Q32uKLbbu77CrvWhM2I_3NXEsxT0RDMGq-Dm0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1WaQUR9Q32uKLbbu77CrvWhM2I_3NXEsxT0RDMGq-Dm0/edit?usp=drivesdk",
          "cachedResultName": "Jotform Invoice Extraction"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "707dd08c-6896-4888-9b16-699557d09320",
      "name": "Write the Structured Invoice to Disk",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        1296,
        -192
      ],
      "parameters": {
        "options": {},
        "fileName": "=C:\\\\{{ $json.output.invoiceId }}-{{ $json.output.invoiceDate }}.json",
        "operation": "write"
      },
      "typeVersion": 1
    },
    {
      "id": "12cb7d07-9233-4081-92d9-11ebbe70270d",
      "name": "Create a Binary Response",
      "type": "n8n-nodes-base.function",
      "position": [
        1120,
        -192
      ],
      "parameters": {
        "functionCode": "\n\nitems[0].binary = {\n  data: {\n    data: new Buffer(JSON.stringify(items[0].json, null, 2)).toString('base64')\n  }\n};\nreturn items;"
      },
      "typeVersion": 1
    },
    {
      "id": "077170e7-ca49-49be-a8d9-892b999a6724",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        384
      ],
      "parameters": {
        "color": 7,
        "width": 512,
        "height": 512,
        "content": "### **Purpose:**\nAutomates extraction of structured invoice data (ID, company, client, items, totals, etc.) from uploaded **JotForm PDF invoices** and stores results in **Google Sheets** and as JSON on disk.\n\n**Flow Summary:**\n\n1. **Webhook Trigger** \u2014 receives JotForm invoice submission.\n2. **Extract Form Data** \u2014 parses raw request and fetches PDF via JotForm API.\n3. **PDF Reader + GPT-4.1-mini** \u2014 extracts key invoice fields into structured JSON using AI-powered parsing.\n4. **Structured Output Parser** \u2014 validates against custom invoice schema.\n5. **Data Storage** \u2014\n   \u2022 Saves structured JSON locally.\n   \u2022 Appends structured rows to Google Sheet for reporting.\n\n**Integrations:**\n\n* OpenAI GPT-4.1-mini\n* JotForm API\n* Google Sheets\n* Local File Storage\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "575ee55d-ff5f-4ec1-a9a5-e9f711f2b05c",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        368,
        -160
      ],
      "parameters": {
        "color": 5,
        "width": 656,
        "height": 672,
        "content": "## Structured Data Extraction Using OpenAI"
      },
      "typeVersion": 1
    },
    {
      "id": "47621c4a-20cc-455c-b901-d12b93447bb8",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -288
      ],
      "parameters": {
        "color": 3,
        "width": 400,
        "height": 800,
        "content": "## Export Data Handling"
      },
      "typeVersion": 1
    },
    {
      "id": "73c0cc88-4604-4f19-83a2-10ce1bb9ea40",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -128
      ],
      "parameters": {
        "color": 4,
        "width": 512,
        "height": 464,
        "content": "## Webhook Receiver & Data Formatting"
      },
      "typeVersion": 1
    },
    {
      "id": "1f92db74-0623-4785-a62b-18ff14405463",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -128
      ],
      "parameters": {
        "width": 432,
        "height": 464,
        "content": "## Invoice Download & Write to Disk "
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "2b629465-8dc5-4eba-ad21-65f5e50f6280",
  "connections": {
    "Webhook": {
      "main": [
        [
          {
            "node": "Formatted Structured Data Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download Invoice": {
      "main": [
        [
          {
            "node": "Write File from Disk for Inbound Invoice Processing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File": {
      "main": [
        [
          {
            "node": "Structured Data Extract",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Data Extract": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create a Binary Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create a Binary Response": {
      "main": [
        [
          {
            "node": "Write the Structured Invoice to Disk",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Structured Data Extract",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Formatted Structured Data Extract": {
      "main": [
        [
          {
            "node": "Download Invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model for Output Parser": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Output Parser",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model for Structured Data": {
      "ai_languageModel": [
        [
          {
            "node": "Structured Data Extract",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Write File from Disk for Inbound Invoice Processing": {
      "main": [
        [
          {
            "node": "Extract from File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model for Structured Data Formatted Content": {
      "ai_languageModel": [
        [
          {
            "node": "Formatted Structured Data Extract",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    }
  }
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

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

About this workflow

This workflow is designed for Finance teams, accounting professionals, and automation engineers.

Source: https://n8n.io/workflows/9963/ — 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

Resume Screening & Behavioral Interviews with Gemini, Elevenlabs, & Notion ATS copy. Uses outputParserStructured, chainLlm, googleDrive, stickyNote. Webhook trigger; 67 nodes.

Output Parser Structured, Chain Llm, Google Drive +9
AI & RAG

Candidate Engagement | Resume Screening | AI Voice Interviews | Applicant Insights

Output Parser Structured, Chain Llm, Google Drive +9
AI & RAG

Tired of grinding out YouTube content? This n8n workflow turns AI into your personal video factory—creating engaging, faceless shorts on autopilot. Perfect for creators, marketers, or side-hustlers lo

HTTP Request, Google Drive, Google Sheets +6
AI & RAG

Faceless YouTube Generator. Uses httpRequest, limit, googleDrive, googleSheets. Webhook trigger; 49 nodes.

HTTP Request, Google Drive, Google Sheets +7
AI & RAG

[](https://www.youtube.com/watch?v=NAn5BSr15Ks) &gt; This workflow connects a Slack chatbot with AI agents and Google Sheets to automate candidate resume evaluation. It extracts resume details, identi

HTTP Request, Output Parser Structured, OpenAI Chat +6