YouTube Trend Detector
YouTube Trend Detection and Daily Digest System.
Monitors multiple channels, collects video metrics in Google Sheets, identifies videos performing above each channel's average, and sends a daily HTML email digest with trending videos and performance multipliers.
Shared 8/25/2025
420 views
Visual Workflow
JSON Code
{
"meta": {
"instanceId": "125637e355429ab06f8886794f7df9252a3e338f92a1957141a8989e48f2b612",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "8d427725-1610-4c15-8aaf-9939004c1366",
"name": "When clicking ‘Execute workflow’",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-480,
64
],
"parameters": {},
"typeVersion": 1
},
{
"id": "ad4d56c7-1dfe-488b-9116-ef92af49c4e6",
"name": "Get row(s) in sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
-256,
64
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/15giDQ_DEA4WxMyi_8ecETwexJn3_0pxep4bjl0-JGpA/edit#gid=0",
"cachedResultName": "Channels"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "15giDQ_DEA4WxMyi_8ecETwexJn3_0pxep4bjl0-JGpA",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/15giDQ_DEA4WxMyi_8ecETwexJn3_0pxep4bjl0-JGpA/edit?usp=drivesdk",
"cachedResultName": "YouTube Trend Detector"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "qVntjW61XxH91qGU",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "e4081782-a423-4a36-bb3a-e16cae93f4d6",
"name": "Loop Over Items",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-32,
64
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "8e3e01f1-ae42-448b-bb76-0d15ae3887c4",
"name": "Get many videos",
"type": "n8n-nodes-base.youTube",
"position": [
192,
-16
],
"parameters": {
"limit": 5,
"filters": {
"channelId": "={{ $json.channel_id }}"
},
"options": {},
"resource": "video"
},
"credentials": {
"youTubeOAuth2Api": {
"id": "28T6VWhc9SMBrcGn",
"name": "YouTube account 3"
}
},
"typeVersion": 1
},
{
"id": "46308c1c-4de2-41d0-933e-9366b1e473d7",
"name": "Get a video",
"type": "n8n-nodes-base.youTube",
"position": [
416,
-16
],
"parameters": {
"options": {},
"videoId": "={{ $json.id.videoId }}",
"resource": "video",
"operation": "get"
},
"credentials": {
"youTubeOAuth2Api": {
"id": "28T6VWhc9SMBrcGn",
"name": "YouTube account 3"
}
},
"typeVersion": 1
},
{
"id": "c0ee6ec9-9064-41a8-b58f-9629c917a9c5",
"name": "Filter",
"type": "n8n-nodes-base.filter",
"position": [
640,
-16
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "c3f9211d-dee2-4c66-9586-3bb38c30c2be",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.contentDetails.duration.length() }}",
"rightValue": 5
}
]
}
},
"typeVersion": 2.2
},
{
"id": "b264e8c2-5dd3-4fc5-b78e-b6105c3275ad",
"name": "Append or update row in sheet",
"type": "n8n-nodes-base.googleSheets",
"position": [
864,
64
],
"parameters": {
"columns": {
"value": {
"id": "={{ $json.id }}",
"tags": "={{ $json.snippet.tags.join(', ') }}",
"likes": "={{ $json.statistics.likeCount }}",
"title": "={{ $json.snippet.title }}",
"views": "={{ $json.statistics.viewCount }}",
"comments": "={{ $json.statistics.commentCount }}",
"duration": "={{ $json.contentDetails.duration.split('PT')[1] }}",
"channel_title": "={{ $json.snippet.channelTitle }}",
"thumbnail_high_res": "={{ $json.snippet.thumbnails.high.url }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "title",
"type": "string",
"display": true,
"required": false,
"displayName": "title",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "views",
"type": "string",
"display": true,
"required": false,
"displayName": "views",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "likes",
"type": "string",
"display": true,
"required": false,
"displayName": "likes",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "comments",
"type": "string",
"display": true,
"required": false,
"displayName": "comments",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "tags",
"type": "string",
"display": true,
"required": false,
"displayName": "tags",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "thumbnail_high_res",
"type": "string",
"display": true,
"required": false,
"displayName": "thumbnail_high_res",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "duration",
"type": "string",
"display": true,
"required": false,
"displayName": "duration",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "channel_title",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "channel_title",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "appendOrUpdate",
"sheetName": {
"__rl": true,
"mode": "name",
"value": "={{ $json.snippet.channelId }}"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "15giDQ_DEA4WxMyi_8ecETwexJn3_0pxep4bjl0-JGpA",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/15giDQ_DEA4WxMyi_8ecETwexJn3_0pxep4bjl0-JGpA/edit?usp=drivesdk",
"cachedResultName": "YouTube Trend Detector"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "qVntjW61XxH91qGU",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "f4193372-dd74-4f6d-a2b4-98c58f3ccba1",
"name": "Get row(s) in sheet1",
"type": "n8n-nodes-base.googleSheets",
"position": [
-240,
512
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "list",
"value": "gid=0",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/15giDQ_DEA4WxMyi_8ecETwexJn3_0pxep4bjl0-JGpA/edit#gid=0",
"cachedResultName": "Channels"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "15giDQ_DEA4WxMyi_8ecETwexJn3_0pxep4bjl0-JGpA",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/15giDQ_DEA4WxMyi_8ecETwexJn3_0pxep4bjl0-JGpA/edit?usp=drivesdk",
"cachedResultName": "YouTube Trend Detector"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "qVntjW61XxH91qGU",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "f29e3147-d418-4537-9494-0cf965759d9a",
"name": "Loop Over Items1",
"type": "n8n-nodes-base.splitInBatches",
"position": [
-16,
512
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "5e4c7f78-d304-480c-9122-8ee6ff815286",
"name": "Get row(s) in sheet2",
"type": "n8n-nodes-base.googleSheets",
"position": [
208,
512
],
"parameters": {
"options": {},
"sheetName": {
"__rl": true,
"mode": "name",
"value": "={{ $json.channel_id }}"
},
"documentId": {
"__rl": true,
"mode": "list",
"value": "15giDQ_DEA4WxMyi_8ecETwexJn3_0pxep4bjl0-JGpA",
"cachedResultUrl": "https://docs.google.com/spreadsheets/d/15giDQ_DEA4WxMyi_8ecETwexJn3_0pxep4bjl0-JGpA/edit?usp=drivesdk",
"cachedResultName": "YouTube Trend Detector"
}
},
"credentials": {
"googleSheetsOAuth2Api": {
"id": "qVntjW61XxH91qGU",
"name": "Google Sheets account"
}
},
"typeVersion": 4.6
},
{
"id": "b98415b4-b08d-433b-8726-b3282208b25f",
"name": "Filter1",
"type": "n8n-nodes-base.filter",
"position": [
432,
512
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "321c4340-e69d-43a1-92c4-c42f0dd6d0c8",
"operator": {
"type": "number",
"operation": "gt"
},
"leftValue": "={{ $json.views }}",
"rightValue": "={{ \n $('Get row(s) in sheet2').all().reduce((sum, item) => sum + Number(item.json.views || 0), 0) \n / $('Get row(s) in sheet2').all().length\n}}"
}
]
}
},
"typeVersion": 2.2
},
{
"id": "9f36a804-fbb1-4885-8eb6-a185dddc774a",
"name": "Edit Fields",
"type": "n8n-nodes-base.set",
"position": [
656,
576
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "355f8c07-4773-4cea-8b70-1685f567d069",
"name": "average",
"type": "number",
"value": "={{ \n $('Get row(s) in sheet2').all().reduce((sum, item) => sum + Number(item.json.views || 0), 0) \n / $('Get row(s) in sheet2').all().length\n}}"
}
]
},
"includeOtherFields": true
},
"typeVersion": 3.4
},
{
"id": "6e41d322-a6e7-4853-8125-69707117a63b",
"name": "HTML",
"type": "n8n-nodes-base.html",
"position": [
208,
320
],
"parameters": {
"html": "<tr>\n <td width=\"50%\" valign=\"top\" style=\"padding:5px;\">\n {{\n '<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" style=\"background:#fff;border-radius:4px;overflow:hidden;\">'\n .concat('<tr><td style=\"padding:0;\">')\n .concat('<img src=\"').concat($json.thumbnail_high_res).concat('\" alt=\"').concat($json.title)\n .concat('\" style=\"width:100%;height:310px;object-fit:cover;object-position:center;\">')\n .concat('</td></tr><tr><td style=\"padding:10px;font-family:Arial,sans-serif;\">')\n .concat('<p style=\"font-size:14px;font-weight:bold;color:#222;margin:0 0 5px;\">')\n .concat($json.title).concat('</p>')\n .concat('<p style=\"font-size:12px;color:#666;margin:0 0 3px;\">')\n .concat($json.channel_title).concat('</p>')\n .concat('<p style=\"font-size:12px;color:#666;margin:0 0 3px;\"><strong>Multiple:</strong> ')\n .concat(($json.views/$json.average).round(2)).concat('</p>')\n .concat('<p style=\"font-size:12px;color:#666;margin:0;\">Duration: ')\n .concat($json.duration).concat(' seconds</p>')\n .concat('</td></tr></table>')\n }}\n </td>\n</tr>"
},
"typeVersion": 1.2
},
{
"id": "8fa9d2ca-8d3e-4169-aabf-1ef341d4e98a",
"name": "Send a message",
"type": "n8n-nodes-base.gmail",
"position": [
432,
320
],
"webhookId": "f93c91ee-c0a6-4ffc-9f14-f8786b993cbb",
"parameters": {
"sendTo": "leonidastsantarliotis@gmail.com",
"message": "=<!DOCTYPE html> <html> <head> <meta charset=\"UTF-8\"> <style> /* reset for email clients */ body, table, td { margin:0; padding:0; } img { border:0; display:block; } .wrapper { width:100%; background:#f7f7f7; padding:20px 0; } .container { width:600px; margin:0 auto; background:#fff; border-radius:4px; overflow:hidden; } .header { padding:20px; font-family:Arial,sans-serif; } .header h2 { font-size:20px; margin:0; color:#222; } .grid { width:100%; border-spacing:10px; } </style> </head> <body> <table class=\"wrapper\" cellpadding=\"0\" cellspacing=\"0\"> <tr> <td align=\"center\"> <table class=\"container\" cellpadding=\"0\" cellspacing=\"0\"> <tr> <td class=\"header\"> <h2>YouTube Trend Detector Digest, {{ $now.toLocaleString() }}</h2> </td> </tr> <tr> <td> <table class=\"grid\" cellpadding=\"0\" cellspacing=\"0\"> {{ $('HTML').all().map(item => item.json.html) }} </table> </td> </tr> </table> </td> </tr> </table> </body> </html>",
"options": {},
"subject": "Daily Digest: Trending YouTube Videos"
},
"credentials": {
"gmailOAuth2": {
"id": "EwXXtt2Nq8R5cHzM",
"name": "Gmail account"
}
},
"typeVersion": 2.1
},
{
"id": "46f33788-83ec-4a4e-a19a-41d0ca036f25",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-576,
-96
],
"parameters": {
"width": 1700,
"height": 392,
"content": ""
},
"typeVersion": 1
},
{
"id": "82cc8a5f-3496-40e3-b783-b25673d96a94",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-384,
304
],
"parameters": {
"color": 3,
"width": 1360,
"height": 480,
"content": ""
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"HTML": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
},
"Filter": {
"main": [
[
{
"node": "Append or update row in sheet",
"type": "main",
"index": 0
}
]
]
},
"Filter1": {
"main": [
[
{
"node": "Edit Fields",
"type": "main",
"index": 0
}
]
]
},
"Edit Fields": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Get a video": {
"main": [
[
{
"node": "Filter",
"type": "main",
"index": 0
}
]
]
},
"Get many videos": {
"main": [
[
{
"node": "Get a video",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items": {
"main": [
[],
[
{
"node": "Get many videos",
"type": "main",
"index": 0
}
]
]
},
"Loop Over Items1": {
"main": [
[
{
"node": "HTML",
"type": "main",
"index": 0
}
],
[
{
"node": "Get row(s) in sheet2",
"type": "main",
"index": 0
}
]
]
},
"Get row(s) in sheet": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"Get row(s) in sheet1": {
"main": [
[
{
"node": "Loop Over Items1",
"type": "main",
"index": 0
}
]
]
},
"Get row(s) in sheet2": {
"main": [
[
{
"node": "Filter1",
"type": "main",
"index": 0
}
]
]
},
"Append or update row in sheet": {
"main": [
[
{
"node": "Loop Over Items",
"type": "main",
"index": 0
}
]
]
},
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Get row(s) in sheet",
"type": "main",
"index": 0
}
]
]
}
}
}