Automatically Log Every New YouTube Comment to Google Sheets
Whenever a new comment is posted on your YouTube video, this workflow captures it and appends a row to your Google Sheet. Creators get a searchable, sortable comment log without manual copy-pasting.
- 1
Schedule the workflow to run every hour
Add a
Schedule Triggernode. SetTrigger IntervaltoHoursandHours Between Triggersto1. This polls YouTube regularly without hitting API quota limits. - 2
Fetch recent comments from YouTube
Add an
HTTP Requestnode. SetMethodtoGETandURLtohttps://www.googleapis.com/youtube/v3/commentThreads. InQuery Parametersadd:part=snippet,videoId= your YouTube video ID,maxResults=50,order=time, andkey= your YouTube Data API key. Store your API key in the nodeNotesand paste it into thekeyparameter. - 3
Extract the comment items from the response
Add a
Setnode. Create a field calledcommentsand set its value to the expression{{ $json.items }}. This isolates the array of comment objects returned by the YouTube API so the next node can loop over them. - 4
Split comments into individual items
Add a
Split In Batchesnode — or use the built-inSplit Outoption. Actually, add anItem Listsnode (n8n-nodes-base.itemLists) and setOperationtoSplit Out Items, withField To Split Outset tocomments. Each comment object now flows as its own item. - 5
Append each comment as a row in Google Sheets
Add a
Google Sheetsnode. SetOperationtoAppend. Connect your Google Sheets OAuth2 credential. SetSpreadsheet IDto your sheet's ID (found in the URL) andSheet NametoComments. Map columns:Author={{ $json.snippet.topLevelComment.snippet.authorDisplayName }},Comment={{ $json.snippet.topLevelComment.snippet.textOriginal }},Published At={{ $json.snippet.topLevelComment.snippet.publishedAt }},Video ID={{ $json.snippet.videoId }}.
Frequently asked questions
Will I get duplicate rows if the same comment is fetched twice?
Yes, without deduplication. To prevent this, add a second sheet tab named 'Seen IDs' and use the `Google Sheets` node to check if a comment ID already exists before appending. For a beginner setup, simply run the trigger less frequently (e.g. daily) and manually clear old entries, or upgrade to an Intermediate workflow that includes an IF node for ID checks.
Can I monitor multiple videos at once?
Yes. Duplicate the `HTTP Request` node for each video ID, or store video IDs in a Google Sheet and use a `Google Sheets` read step at the start to loop through them. Keep in mind that each additional video increases your YouTube Data API quota usage.
How do I get a YouTube Data API key?
Go to console.cloud.google.com, create a new project, enable the YouTube Data API v3, and generate an API key under Credentials. Restrict the key to the YouTube Data API to keep it secure. Paste the key into the `key` query parameter of the HTTP Request node.