YouTube Comment Sentiment Analyzer with Google Gemini and Sheets - n8n Workflow

Use this powerful n8n workflow to automatically extract YouTube comments, analyze audience sentiment (Positive, Negative, Neutral) using Google Gemini AI, and log detailed results into Google Sheets. Perfect for social media managers and creators.

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

YouTube Content Creators and Brands needing detailed audience feedback.
Social Media Managers analyzing campaign performance and public perception.
Data Analysts who require structured sentiment data from social platforms.
Users looking for advanced, practical n8n templates integrating AI and APIs.


  • Anyone seeking to leverage an n8n node for large-scale data processing and AI tasks.

Overview

Understanding audience feedback is crucial for content strategy, but manually sifting through thousands of YouTube comments is inefficient. This comprehensive n8n workflow solves this by automating the entire process. It transforms a list of YouTube URLs queued in a Google Sheet into categorized, sentiment-analyzed data, providing immediate insights into audience perception.

This robust n8n automation leverages the YouTube API to fetch comments (handling pagination), and then utilizes the Google Gemini chat model for precise sentiment classification (Positive, Neutral, or Negative). The resulting structured data, including comment text, likes, replies, and analyzed sentiment, is appended directly to another tab in your Google Sheet, ensuring a reliable, trackable data repository. This powerful n8n workflow is a perfect example of how complex multi-step processes can be streamlined using customizable n8n templates.

How it Works

This automated n8n workflow operates via a robust, multi-stage process:


  1. Trigger and Input: The n8n trigger is manual, activated by clicking 'Test workflow'. It immediately utilizes the Google Sheets n8n node to retrieve a queue of video URLs marked 'Ready' from a specified input tab.

  2. Looping and Validation: The workflow initiates a batch loop for each 'Ready' URL after checking that the URL field is not empty.

  3. Data Extraction: An HTTP Request n8n node connects to the YouTube v3 API, using the URL to extract the video ID and fetch all comment threads, configured to handle API pagination to capture large volumes of comments.

  4. Data Structuring: After confirming a successful 200 response, the workflow uses a Split Out n8n node to break the bulk API response into individual comment items, preparing them for AI processing.

  5. AI Sentiment Analysis: Each individual comment passes through an AI Agent n8n node (Sentiment Analysis) which is powered by the Google Gemini Chat Model. This agent analyzes the text and classifies the sentiment as 'Positive', 'Neutral', or 'Negative'.

  6. Results Logging: The classified sentiment data, alongside original comment details (author, likes, published date), is logged via a Google Sheets n8n node into the designated 'Results' tab.

  7. Status Update: Finally, a Google Sheets n8n node updates the original video URL's status in the queue sheet to 'Finished', preventing reprocessing in future runs of this powerful n8n workflow.

Installation Guide

To deploy this custom n8n workflow, follow these steps:


  1. Import the n8n Template: Copy the provided JSON into your n8n instance using the 'Import Workflow' function.

  2. Google Sheet Setup: Duplicate the template Google Sheet necessary for input and output, ensuring you have two tabs: 'Video URLs' (for queueing videos marked 'Ready') and 'Results' (for output).

  3. Credential Configuration: This n8n workflow requires three primary credentials:

Google Sheets: Configure credentials for the Google Sheets n8n node instances (Get Video URLs, Insert Comment Data & Analysis, Update Video Status). Ensure they point to the correct Document ID and Sheet Tabs.
YouTube API: Set up OAuth2 credentials for the YouTube API (used by the HTTP Request - Get Comments n8n node).
* Google Gemini (PaLM/Google AI): Configure API credentials for the Google Gemini Chat Model n8n node, which powers the sentiment analysis agent.

  1. Execution: Enter video URLs into the input Google Sheet, mark them as 'Ready', and click the 'Execute Workflow' button or the 'Test workflow' n8n trigger to start the automation.

Node Details

This n8n workflow utilizes several key n8n node types to achieve its goal:

Manual Trigger (When clicking ‘Test workflow’): The starting n8n trigger for manual execution.
Google Sheets (Get Video URLs): Functions as the input queue manager. It retrieves all rows where the status column equals 'Ready'. This is the initial data source for the n8n workflow.
If (Check If Video URL is Not Empty): A critical core logic n8n node ensuring that only valid data proceeds, checking if the video_url field exists.
Split In Batches (Loop Over Items): This n8n node controls the iteration over the list of video URLs retrieved from the Google Sheet.
HTTP Request (HTTP Request - Get Comments): Fetches comment data from the YouTube API, configured to use YouTube OAuth2 credentials and crucially, includes built-in pagination to retrieve more than the default limit of comments per video.
Split Out (Split Out): Processes the paginated API response, splitting the body.items array into separate n8n items, one per comment, enabling item-level processing by the AI.
If (Check If - Comment Exists): Checks if the split item contains a valid comment snippet before proceeding to the expensive AI step, also providing a route to update the video status if no comments are found.
Google Gemini Chat Model: The language model n8n node providing the inference backbone for the sentiment analysis.
AI Agent - Analyze Sentiment Of Every Comment: A specialized AI n8n node that uses the Gemini model to classify the comment text into 'Positive', 'Neutral', or 'Negative' categories.
Google Sheets (Insert Comment Data & Analysis): An output n8n node that performs an appendOrUpdate operation, saving the extracted comment data and the AI-generated sentiment analysis to the 'Results' sheet.


  • Google Sheets (Update Video Status): Marks the processed video row as 'Finished', ensuring reliable tracking within this complex n8n workflow.

Related n8n Workflows

Free

Nodes: 10 Nodes
Updated: December 26 2025
View all
Created by

Agent Circle - A growing marketplace of AI agents, workflows, and toolkits — built to help teams automate smarter and scale faster

Featured*