{
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "nodes": [
    {
      "id": "d8e13620-5f29-402d-a816-5df35fd547f8",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        760,
        -100
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "f073c57a-a84e-4ccd-8659-26c5c93d4b71",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -280,
        -120
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "4af76036-000e-4810-8f9c-9e2140e17e91",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        240,
        -120
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "e3b8f1ff-2d24-4da8-87e5-488f00a29540",
      "name": "Get Data From Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        0,
        -120
      ],
      "parameters": {
        "options": {},
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "0720d3ae-e6ca-408b-a1dc-8e8849689362",
      "name": "Update Row In Google Sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1840,
        240
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $('Loop Over Items').item.json.url }}",
            "driveurl": "={{ $('Upload File In Google Drive').item.json.webViewLink }}"
          },
          "schema": [
            {
              "id": "url",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "url",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "driveurl",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "driveurl",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "url"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "documentId": {
          "__rl": true,
          "mode": "url",
          "value": ""
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "8ccbdb10-a104-4222-899b-3c933c3caa09",
      "name": "Set Public Permission Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1600,
        -100
      ],
      "parameters": {
        "fileId": {
          "__rl": true,
          "mode": "id",
          "value": "{{ $json.id }}"
        },
        "options": {},
        "operation": "share",
        "permissionsUi": {
          "permissionsValues": {
            "role": "writer",
            "type": "anyone"
          }
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "2b0243db-ef2f-4dcc-b3ea-bd47a33b648c",
      "name": "Upload File In Google Drive",
      "type": "n8n-nodes-base.googleDrive",
      "position": [
        1300,
        -100
      ],
      "parameters": {
        "driveId": {
          "__rl": true,
          "mode": "list",
          "value": "My Drive"
        },
        "options": {},
        "folderId": {
          "__rl": true,
          "mode": "list",
          "value": "root",
          "cachedResultName": "/ (Root folder)"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 3
    },
    {
      "id": "a144ebf4-7c58-460e-98fc-c4096af53a76",
      "name": "Download File",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1000,
        -100
      ],
      "parameters": {
        "url": "={{ $json.medias[1].url }}",
        "options": {}
      },
      "typeVersion": 4.2
    },
    {
      "id": "173c8163-89bb-4bee-bf2f-ada26ac54686",
      "name": "Call TikTok Downloader",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        500,
        -100
      ],
      "parameters": {
        "url": "https://tiktok-video-downloader23.p.rapidapi.com/index.php",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "contentType": "multipart-form-data",
        "sendHeaders": true,
        "bodyParameters": {
          "parameters": [
            {
              "name": "url",
              "value": "={{ $json.url }}"
            }
          ]
        },
        "headerParameters": {
          "parameters": [
            {
              "name": "x-rapidapi-host",
              "value": "tiktok-video-downloader23.p.rapidapi.com"
            },
            {
              "name": "x-rapidapi-key",
              "value": "your key"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "f8802a61-f2bc-4253-aacb-b505305c366b",
      "name": "Sleep",
      "type": "n8n-nodes-base.wait",
      "position": [
        100,
        180
      ],
      "parameters": {},
      "typeVersion": 1.1
    },
    {
      "id": "c4525392-469c-48e4-aa1d-f8e48f8f5b1f",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1100,
        -400
      ],
      "parameters": {
        "width": 560,
        "height": 1280,
        "content": "# \ud83d\udce5 Bulk TikTok Video Downloader & Google Drive Uploader\n\n## \ud83d\udd04 What This Flow Does\n> **Automatically downloads TikTok videos from a list of URLs in a Google Sheet, uploads them to Google Drive, makes the videos publicly accessible, and updates the Google Sheet with the new Google Drive links.**\n\n---\n\n## \u2705 Benefits of This Flow\n\n- \ud83d\ude80 **Fully automated**: No manual downloads, uploads, or updates.\n- \ud83e\uddfe **Centralized tracking**: Keeps original TikTok URLs and uploaded Google Drive links in the same Google Sheet.\n- \ud83d\udd01 **Batch processing**: Processes multiple videos with loop handling and delays.\n- \ud83d\udd13 **Public access**: Files are automatically set to public in Google Drive.\n- \u23f1\ufe0f **Time-saving**: Reduces hours of manual work to a few minutes.\n- \ud83d\udc65 **Team-friendly**: Any team member can add a link to the sheet and get a Drive URL back.\n\n---\n\n## \ud83d\udee0\ufe0f Challenges Solved by This Workflow\n\n| \u274c Problem                              | \u2705 Solution Provided by Flow                         |\n|----------------------------------------|------------------------------------------------------|\n| Manual TikTok video downloads          | Automated via external API                          |\n| Tedious Google Drive uploads           | Automated upload with public permission             |\n| No easy sharing of video files         | Google Drive shareable link generated and updated   |\n| Lack of tracking processed items       | Google Sheet updated with each Drive URL            |\n| High risk of human error               | Fully systemized with minimal manual touchpoints    |\n\n---\n\n## \ud83e\udde9 Core Components \n\n- **Manual Trigger** \u2013 Starts the workflow manually.\n- **Get Data From Google Sheets** \u2013 Fetches TikTok URLs from a sheet.\n- **Loop Over Items** \u2013 Iterates over each URL one at a time.\n- **Call TikTok Downloader** \u2013 Uses an API to get the downloadable video link.\n- **Wait** \u2013 Adds delay before downloading to avoid rate limits.\n- **Download File** \u2013 Downloads the TikTok video file.\n- **Upload File In Google Drive** \u2013 Uploads the video to your Google Drive.\n- **Set Public Permission Google Drive** \u2013 Makes the uploaded file publicly accessible.\n- **Update Row In Google Sheet** \u2013 Updates the original sheet with the new Drive link.\n- **Sleep** \u2013 Adds delay between batches for reliability.\n\n---\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "c16eae53-3bf3-4bb3-b597-48529db0eb66",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -340,
        -260
      ],
      "parameters": {
        "height": 300,
        "content": "## \ud83d\udfe2 When clicking \u2018Execute workflow\u2019\nManually triggers the workflow for testing or running on-demand."
      },
      "typeVersion": 1
    },
    {
      "id": "74b004c2-cb7b-44ad-8f37-4b81035b0aef",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -80,
        -260
      ],
      "parameters": {
        "height": 300,
        "content": "## \ud83d\udcc4 Get Data From Google Sheets\nReads all rows from a specific Google Sheet containing TikTok video URLs."
      },
      "typeVersion": 1
    },
    {
      "id": "2f07afba-7af0-4886-996a-3229220e97ac",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        -260
      ],
      "parameters": {
        "height": 300,
        "content": "## \ud83d\udd01 Loop Over Items\nProcesses each row from the sheet one-by-one (batch looping).\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6a2f0708-f5ea-4899-beaf-e9b1cb2eee2d",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        440,
        -260
      ],
      "parameters": {
        "height": 300,
        "content": "## \ud83c\udf10 Call TikTok Downloader\nSends each TikTok URL to the RapidAPI TikTok downloader to get a direct video download link."
      },
      "typeVersion": 1
    },
    {
      "id": "225452d1-8be6-4822-ba27-2f179c36a509",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        700,
        -260
      ],
      "parameters": {
        "height": 300,
        "content": "## \u23f3 Wait\nAdds a short pause before downloading the file (helps prevent rate-limiting)."
      },
      "typeVersion": 1
    },
    {
      "id": "f7da773d-d280-4bc9-b9cd-a3359ec0853d",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        960,
        -260
      ],
      "parameters": {
        "height": 300,
        "content": "## \u2b07\ufe0f Download File\nDownloads the video from the `medias[1].url` provided by the TikTok downloader API."
      },
      "typeVersion": 1
    },
    {
      "id": "d10bb3cd-edc4-4362-b053-ba3aa227ffda",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1220,
        -260
      ],
      "parameters": {
        "height": 300,
        "content": "## \u2601\ufe0f Upload File In Google Drive\nUploads the downloaded video to Google Drive in the root folder."
      },
      "typeVersion": 1
    },
    {
      "id": "769120e2-9a9e-46a1-a259-936c8825d6fb",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1480,
        -260
      ],
      "parameters": {
        "height": 300,
        "content": "## \ud83d\udd13 Set Public Permission Google Drive\nMakes the uploaded video file publicly accessible by setting sharing permissions.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "bccf0a40-54df-4a80-9f55-3383d78e4d58",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1780,
        80
      ],
      "parameters": {
        "height": 300,
        "content": "## \u270f\ufe0f Update Row In Google Sheet\nUpdates the same row in the sheet by matching `url`, adding the new Drive `webViewLink` in the `driveurl` column.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "f9278864-e0bf-4d6d-8841-3ce87c2e1546",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        80
      ],
      "parameters": {
        "height": 260,
        "content": "## \ud83d\udca4 Sleep\nPauses briefly and loops back to process the next TikTok URL in the list."
      },
      "typeVersion": 1
    }
  ],
  "connections": {
    "Wait": {
      "main": [
        [
          {
            "node": "Download File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Sleep": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Download File": {
      "main": [
        [
          {
            "node": "Upload File In Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [],
        [
          {
            "node": "Call TikTok Downloader",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call TikTok Downloader": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Row In Google Sheet": {
      "main": [
        [
          {
            "node": "Sleep",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Data From Google Sheets": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upload File In Google Drive": {
      "main": [
        [
          {
            "node": "Set Public Permission Google Drive",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Public Permission Google Drive": {
      "main": [
        [
          {
            "node": "Update Row In Google Sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get Data From Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}