{
  "name": "Invoices from Gmail to Drive and Google Sheets",
  "nodes": [
    {
      "id": "0404ef0a-9750-495a-8798-98d4b059a083",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -580,
        -420
      ],
      "parameters": {
        "width": null,
        "height": 440,
        "content": "## Setup\n1. Setup your **Gmail** and **Google Drive** credentials\n2. Setup your **Google Sheets** credentials\n3. Setup your **Openai** api key"
      }
    },
    {
      "id": "8751a7f1-aae4-4746-aae7-3d8563845b8c",
      "name": "Gmail Trigger1",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        -640,
        120
      ]
    },
    {
      "id": "40f62192-5acb-4915-aa07-e5a0dfeb7581",
      "name": "Setup1",
      "type": "n8n-nodes-base.set",
      "position": [
        -300,
        120
      ]
    },
    {
      "id": "d928e797-8851-4ab4-9199-cd555a40eae9",
      "name": "Upload PDF to Drive1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        220,
        0
      ]
    },
    {
      "id": "22df6933-a0c7-4cce-8114-5332038a14c3",
      "name": "Rename file1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        400,
        0
      ]
    },
    {
      "id": "ce6a6a4c-17ba-4cf7-b07a-97b9d8d80844",
      "name": "Move to the correct folder1",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        580,
        0
      ]
    },
    {
      "id": "e64aac5c-a314-46b6-b7db-fc0d6f450e1f",
      "name": "Gmail",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1240,
        0
      ]
    },
    {
      "id": "ea74cfc1-0305-418d-9f5f-bffcfb3bb2c7",
      "name": "Extract from File2",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        1200,
        -180
      ]
    },
    {
      "id": "0398d982-78fd-4830-b5cf-271195af80fd",
      "name": "Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        800,
        0
      ]
    },
    {
      "id": "3b4a96d4-a6ee-486a-a795-fe410ccc38b2",
      "name": "OpenAI Model",
      "type": "@n8n/n8n-nodes-langchain.lmOpenAi",
      "position": [
        1740,
        20
      ]
    },
    {
      "id": "a7dd0d95-5e79-4bd2-a8a6-2178264d19fc",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1940,
        40
      ]
    },
    {
      "id": "68d98f4c-e679-48e3-a1a1-529cda4e31a4",
      "name": "Append to Reconciliation Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2280,
        -140
      ]
    },
    {
      "id": "80e1c8f4-b593-4c5f-b9e2-f3b7996ee6d4",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1680,
        -400
      ],
      "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": "3754e10e-a233-4ce0-bc79-bb5c01db9695",
      "name": "Map Output",
      "type": "n8n-nodes-base.set",
      "position": [
        2080,
        -140
      ]
    },
    {
      "id": "a42ff16f-d0df-4b6d-9a36-849f85d1facc",
      "name": "Apply Data Extraction Rules",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        1740,
        -140
      ]
    },
    {
      "id": "f6de5d5a-d2dc-4590-8f46-3f250b8fca9f",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1860,
        0
      ],
      "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": "255fe8c1-5bd7-41cc-b1f9-c8956b5ad101",
      "name": "Only invoice mails with attachments",
      "type": "n8n-nodes-base.if",
      "position": [
        0,
        120
      ]
    }
  ],
  "connections": {
    "Gmail": {
      "main": [
        []
      ]
    },
    "Setup1": {
      "main": [
        [
          {
            "node": "Only invoice mails with attachments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Map Output": {
      "main": [
        [
          {
            "node": "Append to Reconciliation Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Google Drive": {
      "main": [
        [
          {
            "node": "Extract from File2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model": {
      "ai_languageModel": [
        [
          {
            "node": "Apply Data Extraction Rules",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Rename file1": {
      "main": [
        [
          {
            "node": "Move to the correct folder1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gmail Trigger1": {
      "main": [
        [
          {
            "node": "Setup1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract from File2": {
      "main": [
        [
          {
            "node": "Apply Data Extraction Rules",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload PDF to Drive1": {
      "main": [
        [
          {
            "node": "Rename file1",
            "type": "main",
            "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
          }
        ]
      ]
    },
    "Move to the correct folder1": {
      "main": [
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          },
          {
            "node": "Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Only invoice mails with attachments": {
      "main": [
        [
          {
            "node": "Upload PDF to Drive1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Gmail",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}