The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Drive Uploader Workflow - Service Account",
"nodes": [
{
"parameters": {},
"id": "workflow-start",
"name": "Start",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"functionCode": "// Extract folder ID and prepare data\nconst data = $input.item.json;\nconst folderId = data.driveFolderId; // User's shared folder ID\nconst date = new Date().toISOString().split('T')[0];\nconst folderName = `YT_${data.topic.replace(/\\s+/g, '_')}_${date}`;\n\nreturn {\n parentFolderId: folderId,\n folderName,\n script: data.script,\n title: data.title,\n description: data.description,\n hashtags: data.hashtags,\n audioBase64: data.audioBase64,\n audioFileName: data.audioFileName || 'audio.mp3',\n images: data.images || [],\n userId: data.userId,\n topic: data.topic\n};"
},
"id": "prepare-upload",
"name": "Prepare Upload Data",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
450,
300
]
},
{
"parameters": {
"resource": "folder",
"operation": "create",
"name": "={{ $json.folderName }}",
"parents": {
"parentId": "={{ $json.parentFolderId }}"
}
},
"id": "create-folder",
"name": "Create Subfolder in User's Drive",
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
650,
300
],
"credentials": {
"googleApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"operation": "upload",
"name": "script.txt",
"binaryData": false,
"fileContent": "={{ $('Prepare Upload Data').item.json.script }}",
"parents": {
"parentId": [
"={{ $json.id }}"
]
},
"options": {
"keepRaw": false
}
},
"id": "upload-script",
"name": "Upload Script File",
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
850,
200
],
"credentials": {
"googleApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"functionCode": "// Convert base64 audio to binary for upload\nconst audioBase64 = $('Prepare Upload Data').item.json.audioBase64;\nconst fileName = $('Prepare Upload Data').item.json.audioFileName;\n\n// Create binary data from base64\nconst binaryData = {\n data: audioBase64,\n mimeType: 'audio/mpeg',\n fileName: fileName\n};\n\nreturn {\n json: {\n folderId: $('Create Subfolder in User\\'s Drive').item.json.id,\n fileName: fileName\n },\n binary: {\n data: binaryData\n }\n};"
},
"id": "prepare-audio-binary",
"name": "Prepare Audio Binary",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
850,
300
]
},
{
"parameters": {
"operation": "upload",
"binaryData": true,
"binaryPropertyName": "data",
"name": "={{ $json.fileName }}",
"parents": {
"parentId": [
"={{ $json.folderId }}"
]
}
},
"id": "upload-audio",
"name": "Upload Audio File",
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
1050,
300
],
"credentials": {
"googleApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"functionCode": "// Create metadata JSON file\nconst prepData = $('Prepare Upload Data').item.json;\n\nconst metadata = {\n title: prepData.title,\n description: prepData.description,\n hashtags: prepData.hashtags,\n topic: prepData.topic,\n generatedAt: new Date().toISOString(),\n userId: prepData.userId,\n files: {\n script: 'script.txt',\n audio: prepData.audioFileName,\n images: prepData.images.map((img, idx) => `image_${idx}.png`)\n }\n};\n\nreturn {\n metadataJson: JSON.stringify(metadata, null, 2),\n folderId: $('Create Subfolder in User\\'s Drive').item.json.id\n};"
},
"id": "create-metadata",
"name": "Create Metadata JSON",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1250,
300
]
},
{
"parameters": {
"operation": "upload",
"name": "metadata.json",
"binaryData": false,
"fileContent": "={{ $json.metadataJson }}",
"parents": {
"parentId": [
"={{ $json.folderId }}"
]
}
},
"id": "upload-metadata",
"name": "Upload Metadata",
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
1450,
300
],
"credentials": {
"googleApi": {
"name": "<your credential>"
}
}
},
{
"parameters": {
"functionCode": "// Build response with Drive URLs\nconst folderId = $('Create Subfolder in User\\'s Drive').item.json.id;\nconst scriptId = $('Upload Script File').item.json.id;\nconst audioId = $('Upload Audio File').item.json.id;\nconst metadataId = $json.id;\n\nreturn {\n success: true,\n folderUrl: `https://drive.google.com/drive/folders/${folderId}`,\n scriptUrl: `https://drive.google.com/file/d/${scriptId}/view`,\n audioUrl: `https://drive.google.com/file/d/${audioId}/view`,\n metadataUrl: `https://drive.google.com/file/d/${metadataId}/view`,\n imageUrls: [], // Populated if images are uploaded\n topic: $('Prepare Upload Data').item.json.topic,\n userId: $('Prepare Upload Data').item.json.userId\n};"
},
"id": "format-response",
"name": "Format Response",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1650,
300
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Prepare Upload Data",
"type": "main",
"index": 0
}
]
]
},
"Prepare Upload Data": {
"main": [
[
{
"node": "Create Subfolder in User's Drive",
"type": "main",
"index": 0
}
]
]
},
"Create Subfolder in User's Drive": {
"main": [
[
{
"node": "Upload Script File",
"type": "main",
"index": 0
},
{
"node": "Prepare Audio Binary",
"type": "main",
"index": 0
}
]
]
},
"Prepare Audio Binary": {
"main": [
[
{
"node": "Upload Audio File",
"type": "main",
"index": 0
}
]
]
},
"Upload Audio File": {
"main": [
[
{
"node": "Create Metadata JSON",
"type": "main",
"index": 0
}
]
]
},
"Create Metadata JSON": {
"main": [
[
{
"node": "Upload Metadata",
"type": "main",
"index": 0
}
]
]
},
"Upload Metadata": {
"main": [
[
{
"node": "Format Response",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"staticData": null,
"tags": [],
"triggerCount": 0,
"updatedAt": "2026-01-25T00:00:00.000Z",
"versionId": "2"
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
googleApi
About this workflow
Drive Uploader Workflow - Service Account. Uses executeWorkflowTrigger, googleDrive. Event-driven trigger; 9 nodes.
Source: https://github.com/Prince364133/snap-Tube-ai/blob/7c5acb3d5c26d67fcecd5bc6a7aeef6870a9f98a/n8n-workflows/drive-uploader.json — original creator credit. Request a take-down →