{
  "name": "AI auto-save Gmail receipts to Google Sheets + Google Drive",
  "nodes": [
    {
      "id": "8fdd8f41-acfd-4430-bdfe-b9a43ea81dcc",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        0,
        -640
      ]
    },
    {
      "id": "a8c74ce2-0665-4c34-8e06-1a412f249be4",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1100,
        -640
      ]
    },
    {
      "id": "1b97d088-fcaf-45dd-9d86-acb381984cc0",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        1128,
        -420
      ]
    },
    {
      "id": "5084e1bc-349b-4806-8954-c97a3d26d333",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        1248,
        -420
      ]
    },
    {
      "id": "174f31ac-0849-47aa-8ff1-751d74e952e1",
      "name": "Get Emails with Receipts",
      "type": "n8n-nodes-base.gmail",
      "position": [
        220,
        -640
      ]
    },
    {
      "id": "8fcc7b91-267b-4572-9948-b7a4215cbf44",
      "name": "Get Required Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        660,
        -440
      ]
    },
    {
      "id": "04b2b190-b370-411c-844c-2d8275aa1579",
      "name": "Download Attachment",
      "type": "n8n-nodes-base.gmail",
      "position": [
        440,
        -640
      ]
    },
    {
      "id": "34256129-d04a-4e01-86cc-6a5b2108b954",
      "name": "Append to Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1476,
        -740
      ]
    },
    {
      "id": "1288f2c7-732b-4e35-9d4d-4b20c5f61171",
      "name": "Merge Data",
      "type": "n8n-nodes-base.merge",
      "position": [
        880,
        -640
      ]
    },
    {
      "id": "e67ccaae-5bbc-4023-abbc-c9733d11198c",
      "name": "Upload File",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        660,
        -840
      ]
    },
    {
      "id": "36288b85-6591-4f4a-8637-bf21c8aea23e",
      "name": "Extract Data from Invoice",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        660,
        -640
      ]
    },
    {
      "id": "b9494f63-29ae-42fa-b4ce-6509119d234b",
      "name": "Mark Email as Read",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1476,
        -540
      ]
    },
    {
      "id": "c482e032-f3f4-49d5-81b0-c2ef7f191b13",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        520,
        -1000
      ],
      "parameters": {
        "width": 380,
        "height": 320,
        "content": "### 📤 Upload Receipt to Google Drive\nThis node saves the PDF attachment from the email to your Google Drive.\n- Double-click to choose the destination folder\n- Make sure Google Drive credentials are se"
      }
    },
    {
      "id": "f724e9e1-0de2-4db8-b221-ed5692dc0ab4",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -120,
        -840
      ],
      "parameters": {
        "width": 320,
        "height": 400,
        "content": "### 🕒 Entry Point – Auto-Run This Flow\nThis node controls when the flow is triggered (currently 8am daily).\n- You can change the schedule from cron to manual\n- Starts the chain of pulling emails, extr"
      }
    }
  ],
  "connections": {
    "AI Agent": {
      "main": [
        [
          {
            "node": "Append to Google Sheet",
            "type": "main",
            "index": 0
          },
          {
            "node": "Mark Email as Read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Data": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload File": {
      "main": [
        [
          {
            "node": "Merge Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get Emails with Receipts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Download Attachment": {
      "main": [
        [
          {
            "node": "Upload File",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Required Fields",
            "type": "main",
            "index": 0
          },
          {
            "node": "Extract Data from Invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Required Fields": {
      "main": [
        [
          {
            "node": "Merge Data",
            "type": "main",
            "index": 2
          }
        ]
      ]
    },
    "Append to Google Sheet": {
      "main": [
        []
      ]
    },
    "Get Emails with Receipts": {
      "main": [
        [
          {
            "node": "Download Attachment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "AI Agent",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Extract Data from Invoice": {
      "main": [
        [
          {
            "node": "Merge Data",
            "type": "main",
            "index": 1
          }
        ]
      ]
    }
  }
}