This workflow corresponds to n8n.io template #9641 — we link there as the canonical source.
This workflow follows the Form Trigger → Google Sheets recipe pattern — see all workflows that pair these two integrations.
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 →
{
"id": "aaitjN3jwXzLUnjB",
"name": "Trending Videos by Channel",
"tags": [],
"nodes": [
{
"id": "2496298c-0720-48c2-b814-d2e6884bba81",
"name": "On form submission1",
"type": "n8n-nodes-base.formTrigger",
"position": [
0,
384
],
"parameters": {
"options": {},
"formTitle": "YouTube Channel Analyzer",
"formFields": {
"values": [
{
"fieldType": "dropdown",
"fieldLabel": "Format",
"fieldOptions": {
"values": [
{
"option": "short"
},
{
"option": "medium"
},
{
"option": "long"
}
]
},
"requiredField": true
},
{
"fieldType": "number",
"fieldLabel": "Number of Videos",
"placeholder": "Enter number of videos to fetch (default 5)",
"requiredField": true
},
{
"fieldLabel": "Channel Name",
"placeholder": "Enter the YouTube channel name",
"requiredField": true
}
]
},
"formDescription": "Fetch trending videos from a specific channel"
},
"typeVersion": 2.2
},
{
"id": "eaf07791-3de3-4b28-86b7-d9d8c72540aa",
"name": "Set Parameters1",
"type": "n8n-nodes-base.set",
"position": [
208,
384
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"name": "api_key",
"type": "string",
"value": "<api-key>"
},
{
"name": "format",
"type": "string",
"value": "={{ $json.Format }}"
},
{
"name": "videoLimit",
"type": "string",
"value": "={{ $json['Number of Videos'] }}"
},
{
"name": "channel_name",
"type": "string",
"value": "={{ $json['Channel Name'] }}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "554048e6-db9b-4039-8a3f-e1223535581d",
"name": "Get Channel ID1",
"type": "n8n-nodes-base.httpRequest",
"position": [
416,
384
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/search",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet"
},
{
"name": "type",
"value": "channel"
},
{
"name": "q",
"value": "={{ $json.channel_name }}"
},
{
"name": "key",
"value": "Use your Api Key"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "d7f5e607-d8a7-4e0e-aeba-70ce0d0c605e",
"name": "Extract Channel ID1",
"type": "n8n-nodes-base.code",
"position": [
592,
384
],
"parameters": {
"jsCode": "return [{ json: { channelId: $json.items[0].id.channelId } }];"
},
"typeVersion": 2
},
{
"id": "568257fb-7ebf-49ae-a2c2-b694554898e3",
"name": "Get Video IDs1",
"type": "n8n-nodes-base.httpRequest",
"position": [
832,
384
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/search",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet"
},
{
"name": "maxResults",
"value": "={{ $json.videoLimit || 5 }}"
},
{
"name": "order",
"value": "viewCount"
},
{
"name": "channelId",
"value": "={{ $json.channelId }}"
},
{
"name": "type",
"value": "video"
},
{
"name": "videoDuration",
"value": "={{ $json.format }}"
},
{
"name": "key",
"value": "Use your key"
},
{
"name": "regionCode",
"value": "US"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "5990323f-71c3-47b1-9c90-1223447b708c",
"name": "Extract IDs1",
"type": "n8n-nodes-base.code",
"position": [
1008,
384
],
"parameters": {
"jsCode": "const items = $input.all();\nreturn items.flatMap(item => (item.json?.items || []).map(videoItem => ({ json: { videoid: videoItem?.id?.videoId || null } })));\n"
},
"typeVersion": 2
},
{
"id": "f6ea02fe-25c9-4a84-896f-f439ff4f07d5",
"name": "Get Video Data1",
"type": "n8n-nodes-base.httpRequest",
"position": [
1216,
384
],
"parameters": {
"url": "https://www.googleapis.com/youtube/v3/videos",
"options": {},
"sendQuery": true,
"queryParameters": {
"parameters": [
{
"name": "part",
"value": "snippet,statistics"
},
{
"name": "id",
"value": "={{ $json.videoid }}"
},
{
"name": "key",
"value": "Use your Youtube Api"
}
]
}
},
"typeVersion": 4.2
},
{
"id": "5fea0e50-6af3-46ff-80ff-10d0e76f1963",
"name": "Extract Video Data1",
"type": "n8n-nodes-base.code",
"position": [
1408,
384
],
"parameters": {
"jsCode": "const items = $input.all();\nreturn items.flatMap(item =>\n (item.json?.items || []).map(videoItem => ({\n json: {\n channelTitle: videoItem.snippet?.channelTitle || '',\n title: videoItem.snippet?.title || '',\n description: videoItem.snippet?.description || '', // \u2b05\ufe0f added\n viewCount: videoItem.statistics?.viewCount || 0,\n likeCount: videoItem.statistics?.likeCount || 0,\n commentCount: videoItem.statistics?.commentCount || 0,\n videoURL: `https://www.youtube.com/watch?v=${videoItem.id || ''}`,\n thumbnail: videoItem.snippet?.thumbnails?.high?.url || ''\n }\n }))\n);\n"
},
"typeVersion": 2
},
{
"id": "8291de16-4e04-43dc-a5b2-b3f2c104be54",
"name": "Video Performance1",
"type": "n8n-nodes-base.code",
"position": [
1792,
384
],
"parameters": {
"jsCode": "const items = $input.all();\nreturn items.map(item => {\n const viewCount = parseInt(item.json.viewCount || '0', 10);\n const likeCount = parseInt(item.json.likeCount || '0', 10);\n const commentCount = parseInt(item.json.commentCount || '0', 10);\n let performance = 0;\n if (viewCount > 0) {\n performance = ((likeCount + commentCount) / viewCount) * 100;\n }\n return { json: { ...item.json, performance: performance.toFixed(2) } };\n});"
},
"typeVersion": 2
},
{
"id": "c1053470-9136-4c9e-a492-dbfe207fa869",
"name": "Append row in sheet1",
"type": "n8n-nodes-base.googleSheets",
"position": [
2032,
384
],
"parameters": {
"columns": {
"value": {
"hook": "={{ $json.hook }}",
"title": "={{ $json.title }}",
"videoURL": "={{ $json.videoURL }}",
"likeCount": "={{ $json.likeCount }}",
"thumbnail": "={{ $json.thumbnail }}",
"viewCount": "={{ $json.viewCount }}",
"description": "={{ $json.description }}",
"performance": "={{ $json.performance }}",
"channelTitle": "={{ $json.channelTitle }}",
"commentCount": "={{ $json.commentCount }}"
},
"schema": [
{
"id": "channelTitle",
"type": "string",
"display": true,
"required": false,
"displayName": "channelTitle",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "description",
"type": "string",
"display": true,
"required": false,
"displayName": "description",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "viewCount",
"type": "string",
"display": true,
"required": false,
"displayName": "viewCount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "likeCount",
"type": "string",
"display": true,
"required": false,
"displayName": "likeCount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "commentCount",
"type": "string",
"display": true,
"required": false,
"displayName": "commentCount",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "videoURL",
"type": "string",
"display": true,
"required": false,
"displayName": "videoURL",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "thumbnail",
"type": "string",
"display": true,
"required": false,
"displayName": "thumbnail",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "hook",
"type": "string",
"display": true,
"required": false,
"displayName": "hook",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "performance",
"type": "string",
"display": true,
"required": false,
"displayName": "performance",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "append",
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1muc55xphO5rYn6uO1rxfb_-W1xruMIcFmbQE6EPRFBQ/edit#gid=0",
"cachedResultName": "Sheet1"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/1muc55xphO5rYn6uO1rxfb_-W1xruMIcFmbQE6EPRFBQ/edit?usp=drivesdk",
"cachedResultName": "YouTube Viral Videos"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"name": "<your credential>"
}
},
"typeVersion": 4.6
},
{
"id": "201adcea-9f77-4a32-8cd6-e47d750d8b36",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-48,
320
],
"parameters": {
"width": 384,
"height": 224,
"content": "## Write the Channel name\n"
},
"typeVersion": 1
},
{
"id": "07eee8a6-6ec2-43b9-8603-9a43e2e53976",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
352,
320
],
"parameters": {
"color": 6,
"width": 400,
"height": 224,
"content": "## Get Channel ID's\n"
},
"typeVersion": 1
},
{
"id": "f3995972-de6a-45a5-8c07-b9da4e82c40e",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
768,
320
],
"parameters": {
"color": 4,
"width": 400,
"height": 224,
"content": "## Get Video ID's\n"
},
"typeVersion": 1
},
{
"id": "b912ba40-864b-4244-bcb8-c9a5ff854fd0",
"name": "Sticky Note3",
"type": "n8n-nodes-base.stickyNote",
"position": [
1184,
304
],
"parameters": {
"width": 736,
"height": 272,
"content": "## Extract the video data Like Views , Likes , Title & Description "
},
"typeVersion": 1
},
{
"id": "1d538749-fe4c-4fa1-bffa-3cd40aac2cc3",
"name": "Sticky Note4",
"type": "n8n-nodes-base.stickyNote",
"position": [
1952,
320
],
"parameters": {
"color": 3,
"width": 288,
"height": 240,
"content": "## Save Data in a Sheet"
},
"typeVersion": 1
},
{
"id": "8a65fcbf-3734-4abb-9991-73015894cab2",
"name": "Sticky Note5",
"type": "n8n-nodes-base.stickyNote",
"position": [
576,
80
],
"parameters": {
"color": 4,
"width": 752,
"height": 144,
"content": "# Get Viral videos data of your Competitor"
},
"typeVersion": 1
},
{
"id": "2b71d06b-99dd-4dab-b022-b70e311029d7",
"name": "Hook and Description",
"type": "n8n-nodes-base.code",
"position": [
1584,
384
],
"parameters": {
"jsCode": "const items = $input.all();\nreturn items.map(item => {\n const desc = item.json.description || \"\";\n // take the first 15 words of description as a \"hook\"\n const hook = desc.split(\" \").slice(0, 15).join(\" \");\n \n return {\n json: {\n ...item.json,\n hook\n }\n };\n});\n"
},
"typeVersion": 2
},
{
"id": "4de94c83-21aa-498b-8eec-14f42ecff894",
"name": "Sticky Note6",
"type": "n8n-nodes-base.stickyNote",
"position": [
-832,
96
],
"parameters": {
"width": 768,
"height": 768,
"content": "# Get Viral Videos Data of Your Competitor\n\n## This workflow automatically extracts YouTube competitor video data.\nEnter a channel name \u2192 it fetches the channel ID, gathers recent video data (views, likes, titles, descriptions), and saves it to your Google Sheet.\n\n# Steps:\n\nOn form submission, provide a YouTube channel name.\n\nThe workflow finds its Channel ID.\n\nIt retrieves all recent Video IDs.\n\nExtracts key video metrics (Views, Likes, Title, Description).\n\nAppends the data to your Google Sheet for tracking.\n\n# Use Cases:\n\nAnalyze competitors\u2019 most engaging videos.\n\nSpot trends before they go viral.\n\nTrack performance metrics over time.\n\n\ud83d\udca1 Tip: You can extend it by adding an OpenAI node to summarize top-performing videos or find content patterns automatically."
},
"typeVersion": 1
}
],
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "a7671256-6235-4271-aff4-be36e1023da7",
"connections": {
"Extract IDs1": {
"main": [
[
{
"node": "Get Video Data1",
"type": "main",
"index": 0
}
]
]
},
"Get Video IDs1": {
"main": [
[
{
"node": "Extract IDs1",
"type": "main",
"index": 0
}
]
]
},
"Get Channel ID1": {
"main": [
[
{
"node": "Extract Channel ID1",
"type": "main",
"index": 0
}
]
]
},
"Get Video Data1": {
"main": [
[
{
"node": "Extract Video Data1",
"type": "main",
"index": 0
}
]
]
},
"Set Parameters1": {
"main": [
[
{
"node": "Get Channel ID1",
"type": "main",
"index": 0
}
]
]
},
"Video Performance1": {
"main": [
[
{
"node": "Append row in sheet1",
"type": "main",
"index": 0
}
]
]
},
"Extract Channel ID1": {
"main": [
[
{
"node": "Get Video IDs1",
"type": "main",
"index": 0
}
]
]
},
"Extract Video Data1": {
"main": [
[
{
"node": "Hook and Description",
"type": "main",
"index": 0
}
]
]
},
"On form submission1": {
"main": [
[
{
"node": "Set Parameters1",
"type": "main",
"index": 0
}
]
]
},
"Hook and Description": {
"main": [
[
{
"node": "Video Performance1",
"type": "main",
"index": 0
}
]
]
}
}
}
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.
googleSheetsOAuth2Api
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Automatically collect and analyze your competitor’s YouTube performance. This workflow extracts video titles, views, likes, and descriptions from any YouTube channel and saves the data to Google Sheets — helping creators spot viral trends and plan content that performs.
Source: https://n8n.io/workflows/9641/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
Disclaimer: this workflow only works on self-hosted instances due to the file system usage.
This n8n workflow automates the process of scraping job listings from both LinkedIn and Indeed platforms simultaneously, combining results, and exporting data to Google Sheets for comprehensive job ma
🚀 Discover trending and viral YouTube videos easily with this powerful n8n automation! This workflow helps you perform bulk research on YouTube videos related to any search term, analyzing engagement
This automated workflow allows seamless conversion of YouTube videos to MP3, using the YouTube to MP3 Downloader API. The converted MP3 files are uploaded to Google Drive, and all relevant conversion
Convert TikTok videos to MP4 , MP3 (without watermark), upload to Google Drive, and log conversion attempts into Google Sheets automatically — powered by TikTok Download Audio Video API.