{
  "name": "Extract spending history from gmail to google sheet",
  "nodes": [
    {
      "id": "8e1e0861-9f06-4fe2-a9c1-423bab246959",
      "name": "Get invoice",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        600,
        380
      ]
    },
    {
      "id": "364fe355-672a-4074-800a-a7496c4fb1b2",
      "name": "Get payment",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        600,
        580
      ]
    },
    {
      "id": "e3218faf-2486-46e0-bf43-3bc52927e2bd",
      "name": "Extract invoice",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        820,
        380
      ]
    },
    {
      "id": "3772b3dc-7601-4005-9b61-263b2c1abd5f",
      "name": "Extract payment",
      "type": "n8n-nodes-base.extractFromFile",
      "position": [
        820,
        580
      ]
    },
    {
      "id": "10d57038-940e-47aa-84ea-3850f61ac757",
      "name": "HTML",
      "type": "n8n-nodes-base.html",
      "position": [
        1440,
        200
      ]
    },
    {
      "id": "dae6d22e-587d-4102-b006-20a341ede5ee",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1660,
        200
      ]
    },
    {
      "id": "0d75443d-0d23-4120-95e5-b3128a760fb4",
      "name": "Structured Output Parser1",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2500,
        640
      ]
    },
    {
      "id": "7ade499c-015b-4903-8129-6c135264bf75",
      "name": "Google Gemini Chat Model1",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        2320,
        640
      ]
    },
    {
      "id": "10fe4a38-139b-4284-9e86-dd36e472f59e",
      "name": "Send",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2740,
        480
      ]
    },
    {
      "id": "87ab4932-aae5-4c5a-a175-c782bebdf781",
      "name": "Set data 0",
      "type": "n8n-nodes-base.set",
      "position": [
        1860,
        200
      ]
    },
    {
      "id": "c2829f41-1e3f-40bc-8d4b-9fd1bac41381",
      "name": "Set data 1",
      "type": "n8n-nodes-base.set",
      "position": [
        1660,
        440
      ]
    },
    {
      "id": "ecf9ea3c-3f34-43ef-b101-ca4a420e4c24",
      "name": "Set data 2",
      "type": "n8n-nodes-base.set",
      "position": [
        1640,
        740
      ]
    },
    {
      "id": "0d9f8bde-af54-480c-bdc9-15cd5b0e6f28",
      "name": "Invoice data",
      "type": "n8n-nodes-base.set",
      "position": [
        1040,
        380
      ]
    },
    {
      "id": "c1c4c490-d7a9-4b16-a81b-a338103764b6",
      "name": "Payment data",
      "type": "n8n-nodes-base.set",
      "position": [
        1040,
        580
      ]
    },
    {
      "id": "01c5a934-9412-4ef9-81a8-c4aef19c8868",
      "name": "Switch",
      "type": "n8n-nodes-base.switch",
      "position": [
        1300,
        480
      ]
    },
    {
      "id": "250bbd9a-3d22-4a04-910c-7cec437b3c33",
      "name": "Groq Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGroq",
      "position": [
        2320,
        1120
      ]
    },
    {
      "id": "b8d2b2fc-748c-43c5-a82b-d5e7357bbef8",
      "name": "Structured Output Parser",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        2520,
        1120
      ]
    },
    {
      "id": "39b10715-54fe-4c07-9ca1-afbe43ae519e",
      "name": "Send1",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2740,
        900
      ]
    },
    {
      "id": "112f5198-871e-42f9-9376-5fa074497413",
      "name": "Extract details1",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2320,
        900
      ]
    },
    {
      "id": "b9c3cb29-e68e-4ae0-8930-185c17bc6cab",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        2060,
        440
      ]
    },
    {
      "id": "b50d632c-b762-4f61-b34a-91f941100668",
      "name": "Extract details",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        2320,
        480
      ]
    },
    {
      "id": "7a7e2e36-a8b6-48dc-ad57-2f5eea691285",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        220
      ],
      "parameters": {
        "width": 720,
        "height": 560,
        "content": "# A. Get data\n- Set up labels in Gmail\n- Suggested using Gmail filters to move emails to labels automatically"
      }
    },
    {
      "id": "108becad-1a7b-4409-9cb3-36a1c7b64786",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1280,
        -20
      ],
      "parameters": {
        "width": 920,
        "height": 960,
        "content": "# B. Deal with the data\n1. Multiple payment info in one mail: input the \"sender\" of the emails that contain more than one payment info. e.g. credit card daily spend notification\n2. One payment info in"
      }
    },
    {
      "id": "7123f576-87f9-4df1-ae24-f3e5289c7234",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2240,
        320
      ],
      "parameters": {
        "width": 840,
        "height": 980,
        "content": "# C. Get spend details and send to google sheet\n- Edit the output schema to fit your google sheet format\n- Edit the prompt to fit your needs"
      }
    }
  ],
  "connections": {
    "HTML": {
      "main": [
        [
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge": {
      "main": [
        [
          {
            "node": "Extract details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch": {
      "main": [
        [
          {
            "node": "HTML",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set data 1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set data 2",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Set data 0",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set data 0": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set data 1": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Set data 2": {
      "main": [
        [
          {
            "node": "Extract details1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get invoice": {
      "main": [
        [
          {
            "node": "Extract invoice",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get payment": {
      "main": [
        [
          {
            "node": "Extract payment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Invoice data": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Payment data": {
      "main": [
        [
          {
            "node": "Switch",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract details": {
      "main": [
        [
          {
            "node": "Send",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract invoice": {
      "main": [
        [
          {
            "node": "Invoice data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract payment": {
      "main": [
        [
          {
            "node": "Payment data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Groq Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Extract details1",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Extract details1": {
      "main": [
        [
          {
            "node": "Send1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "Extract details1",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model1": {
      "ai_languageModel": [
        [
          {
            "node": "Extract details",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser1": {
      "ai_outputParser": [
        [
          {
            "node": "Extract details",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    }
  }
}