{
  "name": "Organize Gmail attachments in Google Drive folders based on sender’s email",
  "nodes": [
    {
      "id": "f43882ce-f96b-4706-8428-6ff4d1689a88",
      "name": "Gmail Trigger",
      "type": "n8n-nodes-base.gmailTrigger",
      "position": [
        112,
        -656
      ]
    },
    {
      "id": "ff5b5a09-be36-45a3-b48d-3b24270117a9",
      "name": "When clicking ‘Execute workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        112,
        -464
      ]
    },
    {
      "id": "061aa9ae-cea6-4df3-b3cc-bc1f6b746c43",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        752,
        -464
      ]
    },
    {
      "id": "4f749dc4-e450-4150-9d97-0dd2ef450783",
      "name": "Split Out",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        1392,
        -448
      ]
    },
    {
      "id": "7a0281bf-1e45-4c00-acde-aa89f79ee578",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        2272,
        -432
      ]
    },
    {
      "id": "4827d788-9982-42f0-bf98-767ea5c890cc",
      "name": "Create folder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1792,
        -16
      ]
    },
    {
      "id": "b77f08ca-70f3-4f4e-87dc-3c0cd365b3ee",
      "name": "When Executed by Another Workflow",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        2656,
        -656
      ]
    },
    {
      "id": "4b81e6cb-784b-4cef-a65f-5b3664e52db5",
      "name": "Execute Workflow",
      "type": "n8n-nodes-base.executeWorkflow",
      "position": [
        2640,
        -432
      ]
    },
    {
      "id": "d50b2f82-1120-4496-ad33-7196b8996723",
      "name": "Get emails",
      "type": "n8n-nodes-base.gmail",
      "position": [
        416,
        -464
      ]
    },
    {
      "id": "c030f11a-dc3d-4e20-8ad2-46afafb9cbdb",
      "name": "Get email",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1104,
        -448
      ]
    },
    {
      "id": "53ca4e5b-5840-473a-8343-1ea07f4ea9b0",
      "name": "Contain attachments?",
      "type": "n8n-nodes-base.if",
      "position": [
        1104,
        -160
      ]
    },
    {
      "id": "11f81936-1b0a-4dc8-b4a2-910c6b7622be",
      "name": "Search folders",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1360,
        -176
      ]
    },
    {
      "id": "89d037ce-e0ae-4199-9cf7-d3bd4aa4bf8d",
      "name": "Exist?",
      "type": "n8n-nodes-base.if",
      "position": [
        1616,
        -176
      ]
    },
    {
      "id": "b2475306-50e8-434a-9ef0-efdb9afeb08e",
      "name": "Folder ID",
      "type": "n8n-nodes-base.set",
      "position": [
        1984,
        -192
      ]
    },
    {
      "id": "97c82abe-87ac-4b72-bb00-1616b8ca4731",
      "name": "Get attachments",
      "type": "n8n-nodes-base.code",
      "position": [
        1824,
        -448
      ]
    },
    {
      "id": "3fa07a7b-505b-474b-9dba-2c8cd0bc02cc",
      "name": "Upload attachment",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        2928,
        -656
      ]
    },
    {
      "id": "772dd36f-ef1a-48bf-89e5-feba92b963c2",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        112,
        -912
      ],
      "parameters": {
        "width": 704,
        "height": 208,
        "content": "## Organize Gmail Attachments in Google Drive Folders based on sender’s email\n\nThis workflow automatically processes emails received in Gmail, extracts their attachments, and organizes them into speci"
      }
    }
  ],
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Execute Workflow",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Exist?": {
      "main": [
        [
          {
            "node": "Folder ID",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create folder",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Folder ID": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get email": {
      "main": [
        [
          {
            "node": "Contain attachments?",
            "type": "main",
            "index": 0
          },
          {
            "node": "Split Out",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Out": {
      "main": [
        [
          {
            "node": "Get attachments",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get emails": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create folder": {
      "main": [
        [
          {
            "node": "Folder ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search folders": {
      "main": [
        [
          {
            "node": "Exist?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get attachments": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Get email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload attachment": {
      "main": [
        []
      ]
    },
    "Contain attachments?": {
      "main": [
        [
          {
            "node": "Search folders",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Executed by Another Workflow": {
      "main": [
        [
          {
            "node": "Upload attachment",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Execute workflow’": {
      "main": [
        [
          {
            "node": "Get emails",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}