{
  "name": "Create Google Drive folders by path",
  "nodes": [
    {
      "id": "4c9256c8-8dd7-4e81-8aef-0789e6808808",
      "name": "When clicking ‘Test workflow’",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -260,
        80
      ]
    },
    {
      "id": "1935ad6a-ade4-4073-9205-0c3dd1091c0f",
      "name": "Set parameters for next run",
      "type": "n8n-nodes-base.code",
      "position": [
        1520,
        460
      ]
    },
    {
      "id": "5d99a9c4-57c6-4052-b093-fb0c32d9ff56",
      "name": "Execute Workflow Trigger",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -40,
        460
      ]
    },
    {
      "id": "879b92ae-edab-4d73-96d0-4df36d12fbb2",
      "name": "Dummy input data",
      "type": "n8n-nodes-base.set",
      "position": [
        -40,
        80
      ]
    },
    {
      "id": "822d45f1-149d-430c-8daf-183998c01166",
      "name": "Split the desired path",
      "type": "n8n-nodes-base.code",
      "position": [
        340,
        260
      ]
    },
    {
      "id": "e2aba13a-fec6-4d1e-aa1c-af95d3f957ad",
      "name": "Create desired path",
      "type": "n8n-nodes-base.code",
      "position": [
        580,
        260
      ]
    },
    {
      "id": "aa3f9b95-3197-4b89-bcb2-9e723b8496a0",
      "name": "Check if top folder exists",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        800,
        260
      ]
    },
    {
      "id": "969b7823-2720-45c5-b98c-1cc659fe62df",
      "name": "If top folder doesn't exist",
      "type": "n8n-nodes-base.if",
      "position": [
        1040,
        260
      ]
    },
    {
      "id": "2cd3932d-b066-438a-b968-4078dfc9dbe7",
      "name": "Create new subfolder",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1340,
        240
      ]
    },
    {
      "id": "f9322682-b77f-4bad-8bbc-13868c126063",
      "name": "If path has been completely created",
      "type": "n8n-nodes-base.if",
      "position": [
        1740,
        460
      ]
    },
    {
      "id": "94c4694b-0a32-4681-b977-c01e3232d9e8",
      "name": "Return the ID of the last folder",
      "type": "n8n-nodes-base.set",
      "position": [
        2040,
        440
      ]
    },
    {
      "id": "5e9f327d-61bb-46af-b16b-21499f5c22e0",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -820,
        -80
      ],
      "parameters": {
        "width": 480,
        "height": 880,
        "content": "# Create Google Drive Folders by Path\nThis workflow created nested Google Drive folder from a path string and returns the ID of the final folder for immediate use.\n\nUse this workflow in your other flo"
      }
    },
    {
      "id": "35b3741f-465a-4846-9f62-4dedc40ca884",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        -20
      ],
      "parameters": {
        "width": 500,
        "height": 80,
        "content": "## Test data for the workflow\nUse this in case you want to test the workflow."
      }
    },
    {
      "id": "3b7fe210-d966-4988-aaf4-5e07567b3054",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -280,
        320
      ],
      "parameters": {
        "width": 500,
        "height": 120,
        "content": "## Triggered from another workflow\nThis workflow is intended to be triggered by other workflows. Don't copy/paste this workflow as it will be more difficult to maintain and keep up-to-date."
      }
    },
    {
      "id": "16477e77-656e-4bff-914f-633d61477d38",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        560,
        80
      ],
      "parameters": {
        "width": 1320,
        "height": 120,
        "content": "## Main loop\nTake the desired_path and split it into parts. Eg: `Projects/Clients/Reports` will turn into 3 parts: Projects, Clients, Reports.\nWe then check if the top folder exists and create it if n"
      }
    },
    {
      "id": "57404f59-28b8-4969-b483-fb8a3320a592",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1980,
        80
      ],
      "parameters": {
        "width": 280,
        "height": 120,
        "content": "## Rerturn data\nHere we return the ID of the last folder in the path, so you can start uploading new files to it."
      }
    }
  ],
  "connections": {
    "Dummy input data": {
      "main": [
        [
          {
            "node": "Split the desired path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create desired path": {
      "main": [
        [
          {
            "node": "Check if top folder exists",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create new subfolder": {
      "main": [
        [
          {
            "node": "Set parameters for next run",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split the desired path": {
      "main": [
        [
          {
            "node": "Create desired path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Execute Workflow Trigger": {
      "main": [
        [
          {
            "node": "Split the desired path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check if top folder exists": {
      "main": [
        [
          {
            "node": "If top folder doesn't exist",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If top folder doesn't exist": {
      "main": [
        [
          {
            "node": "Create new subfolder",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set parameters for next run",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set parameters for next run": {
      "main": [
        [
          {
            "node": "If path has been completely created",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking ‘Test workflow’": {
      "main": [
        [
          {
            "node": "Dummy input data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If path has been completely created": {
      "main": [
        [
          {
            "node": "Return the ID of the last folder",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create desired path",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}