{
  "name": "Automated invoice data extraction with LlamaParse, Gemini 2.5 & Google Sheets",
  "nodes": [
    {
      "id": "87d0fa7b-1a42-4f48-a942-9e8ff3ab4823",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        420,
        360
      ]
    },
    {
      "id": "9e253f1c-f58c-4ad0-a105-8fc65825b749",
      "name": "Upload to LlamaParse",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -560,
        300
      ]
    },
    {
      "id": "8654de08-2169-4014-a320-f141b341f367",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        -40
      ],
      "parameters": {
        "width": 786,
        "height": 703,
        "content": "## 2. Advanced PDF Processing with LlamaParse\n[Read more about using HTTP Requests](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/)\n\nLlamaIndex's LlamaCloud is a cloud"
      }
    },
    {
      "id": "dac79610-f778-4772-a667-5f3d1afd5cd1",
      "name": "Receiving Invoices",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -1400,
        280
      ]
    },
    {
      "id": "8f8b951f-401c-4e10-a879-7b8f12aa1138",
      "name": "Append to Reconciliation Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        780,
        200
      ]
    },
    {
      "id": "c0489efe-133d-4176-bb6a-b052a6acf25e",
      "name": "Get Processing Status",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -380,
        300
      ]
    },
    {
      "id": "4103a5e3-da0c-4c58-9310-a0874ce39dc8",
      "name": "Wait to stay within service limits",
      "type": "n8n-nodes-base.wait",
      "position": [
        -60,
        440
      ]
    },
    {
      "id": "40ad3a55-0324-4ced-aa1f-e94397e23952",
      "name": "Is Job Ready?",
      "type": "n8n-nodes-base.switch",
      "position": [
        -220,
        300
      ]
    },
    {
      "id": "790f1b50-0cf0-4b6e-bf44-9f1ab81c2c53",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1480,
        20
      ],
      "parameters": {
        "width": 808.8727491350096,
        "height": 709.5781339256318,
        "content": "## 1. Watch for Invoice Emails\n[Read more about Gmail Triggers](https://docs.n8n.io/integrations/builtin/trigger-nodes/n8n-nodes-base.gmailtrigger)\n\nThe Gmail node can watch for all incoming messages "
      }
    },
    {
      "id": "07d74947-0253-433f-9cc5-a2d4df0b517a",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        -60
      ],
      "parameters": {
        "width": 805.0578351924228,
        "height": 656.5014186128178,
        "content": "## 3. Use LLMs to Extract Values from Data\n[Read more about Basic LLM Chain](https://docs.n8n.io/integrations/builtin/cluster-nodes/root-nodes/n8n-nodes-langchain.chainllm/)\n\nLarge language models are"
      }
    },
    {
      "id": "dddc8d62-39a5-49db-8d61-b28427908e2e",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1020,
        40
      ],
      "parameters": {
        "width": 362.3535748101346,
        "height": 440.3435768155051,
        "content": "## 4. Add Label to Avoid Duplication\n[Read more about working with Gmail](https://docs.n8n.io/integrations/builtin/app-nodes/n8n-nodes-base.gmail/)\n\nTo finish off the workflow, we'll add the \"invoice "
      }
    },
    {
      "id": "f42dd5ba-493d-446a-a830-4dc3706c25c8",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1880,
        20
      ],
      "parameters": {
        "width": 360.0244620907562,
        "height": 573.2443601155958,
        "content": "## Try Me Out!\n\n**This workflow does the following:**\n* Waits for email invoices with PDF attachments.\n* Uses the LlamaParse service to convert the invoice PDF into a markdown file.\n* Uses a LLM to ex"
      }
    },
    {
      "id": "47acf270-8538-4472-ac1c-f7b1c8799513",
      "name": "Add \"invoice synced\" Label",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1140,
        280
      ]
    },
    {
      "id": "8d48043d-77bb-4fd0-a70c-2ce17cbf60f2",
      "name": "Get Parsed Invoice Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -20,
        160
      ]
    },
    {
      "id": "50a6af24-76bc-47f9-98e7-e838acc4aaf1",
      "name": "Map Output",
      "type": "n8n-nodes-base.set",
      "position": [
        580,
        200
      ]
    },
    {
      "id": "159d5c04-04f6-4b92-8488-3db5b284a73c",
      "name": "Apply Data Extraction Rules",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        240,
        200
      ]
    },
    {
      "id": "c8eeb893-a290-49e1-91c0-b8070cfbb526",
      "name": "Should Process Email?",
      "type": "n8n-nodes-base.if",
      "position": [
        -840,
        280
      ]
    },
    {
      "id": "5cc4330a-4ef9-4a69-b737-657dd08f971f",
      "name": "Split Out Labels",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        -1200,
        280
      ]
    },
    {
      "id": "e6a8e39e-9189-4fec-95a2-90de7b58d9e6",
      "name": "Get Labels Names",
      "type": "n8n-nodes-base.gmail",
      "position": [
        -1200,
        420
      ]
    },
    {
      "id": "d889db2c-56ae-44a2-8f84-5ea21a7b39e8",
      "name": "Combine Label Names",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        -1200,
        560
      ]
    },
    {
      "id": "843fecd4-f964-42b6-b832-3a2d80101a08",
      "name": "Email with Label Names",
      "type": "n8n-nodes-base.merge",
      "position": [
        -1020,
        280
      ]
    },
    {
      "id": "78f15e24-078a-433f-af0a-14dd35e7cac4",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        360,
        340
      ],
      "parameters": {
        "width": 192.26896179623753,
        "height": 213.73043662572252,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n**Need more attributes?**\nChange it here!"
      }
    },
    {
      "id": "267837d1-5ad3-4b68-a7d2-c7ae201e1fa1",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        180
      ],
      "parameters": {
        "width": 258.29345180972877,
        "height": 397.0641952938746,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n🚨**Required**\n* Set Your Google Sheet URL here\n* Set the Name of your Sheet\n\n\n**Don't use GSheets?**\nSwap this for Excel, Airtable or a Database!"
      }
    },
    {
      "id": "4a87dc87-b5f1-4aad-833c-6da1628a3dda",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1440,
        260
      ],
      "parameters": {
        "width": 174.50671517518518,
        "height": 274.6295678979021,
        "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n🚨**Required**\n* Change the email filters here!"
      }
    },
    {
      "id": "571ca78f-4d3f-4ee2-9f60-f461b9543277",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        240,
        380
      ]
    }
  ],
  "connections": {
    "Map Output": {
      "main": [
        [
          {
            "node": "Append to Reconciliation Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Is Job Ready?": {
      "main": [
        [
          {
            "node": "Get Parsed Invoice Data",
            "type": "main",
            "index": 0
          }
        ],
        [],
        [],
        [
          {
            "node": "Wait to stay within service limits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Labels Names": {
      "main": [
        [
          {
            "node": "Combine Label Names",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out Labels": {
      "main": [
        [
          {
            "node": "Get Labels Names",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receiving Invoices": {
      "main": [
        [
          {
            "node": "Split Out Labels",
            "type": "main",
            "index": 0
          },
          {
            "node": "Email with Label Names",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Label Names": {
      "main": [
        [
          {
            "node": "Email with Label Names",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Upload to LlamaParse": {
      "main": [
        [
          {
            "node": "Get Processing Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Processing Status": {
      "main": [
        [
          {
            "node": "Is Job Ready?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Should Process Email?": {
      "main": [
        [
          {
            "node": "Upload to LlamaParse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Email with Label Names": {
      "main": [
        [
          {
            "node": "Should Process Email?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Parsed Invoice Data": {
      "main": [
        [
          {
            "node": "Apply Data Extraction Rules",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Apply Data Extraction Rules",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Apply Data Extraction Rules",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Apply Data Extraction Rules": {
      "main": [
        [
          {
            "node": "Map Output",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append to Reconciliation Sheet": {
      "main": [
        [
          {
            "node": "Add \"invoice synced\" Label",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait to stay within service limits": {
      "main": [
        [
          {
            "node": "Get Processing Status",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}