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

Analyze YouTube comments automatically using Google Gemini AI. This specialized n8n workflow extracts comments, determines sentiment (positive/negative), and stores all results directly in Google Sheets. Install this n8n template today!

Workflow Preview

Ready to automate?

Download this n8n workflow template and start using it instantly.

Who is this best for?

Content Creators & Marketers: Those needing quick, scalable insights into audience reception.
Community Managers: Individuals who manage large volumes of user feedback and require automatic sentiment classification.
Data Analysts: Users looking for ready-made n8n templates to perform LLM-powered text analysis.
n8n Automation Specialists: Users deploying robust AI solutions using the n8n node ecosystem.

Overview

Manually reading and classifying sentiment across thousands of YouTube comments is impractical and time-consuming. This specialized n8n workflow solves this problem by providing a robust, automated solution. The n8n template leverages the power of the YouTube Data API to extract comments and pairs this data with the sophisticated analytical capabilities of the Google Gemini large language model (LLM). The entire process is orchestrated within this single n8n workflow. It not only fetches the comments but also handles API pagination automatically and ensures that the structured output, including the AI-determined sentiment, is consistently saved to Google Sheets, allowing for easy reporting and visualization. This is a highly efficient, production-ready n8n solution.

How it Works

The entire process begins with a manual n8n trigger ('When clicking ‘Test workflow’').


  1. Initiation and Variable Setup: The n8n trigger feeds into the ID Video n8n node, where the target YouTube video ID is set. Simultaneously, the Get comments n8n node retrieves the data from the designated Google Sheet (used for storing and tracking analysis progress).

  2. Comment Extraction: The workflow uses an HTTP Request n8n node (Get API Comments) to call the YouTube API, requesting the comments for the specified video ID.

  3. Pagination Logic: An If n8n node (Multipage?) checks the API response for a nextPageToken. If the token is present, the nextPageToken n8n node captures it and cycles the request back to the Get API Comments node, ensuring all pages of comments are fetched, regardless of the volume.

  4. Initial Storage: The raw JSON comments are processed by a Code n8n node (Comments) and then split into individual items (Split comments). These raw comments are immediately saved to a Google Sheet using the Save comments n8n node for archival.

  5. AI Processing Loop: The workflow retrieves comments awaiting analysis using the Get comments n8n node. The Loop Over Comments n8n node splits this data into manageable batches for efficient AI processing.

  6. Sentiment Analysis: The core AI function is executed using the Sentiment Analysis n8n node, which is configured to use the Google Gemini n8n node (a Langchain integration). This component determines the sentiment (e.g., positive, negative, neutral) for each comment.

  7. Final Update: The final step involves the Update sentiment Google Sheets n8n node, which takes the analysis result (the determined sentiment) and writes it back to the corresponding row in the Google Sheet. This completes the full cycle of this powerful n8n workflow.

Installation Guide

To deploy this comprehensive n8n workflow template, follow these steps:


  1. Import the n8n workflow: Copy the provided JSON data and navigate to your n8n instance. Click 'New' > 'Import from JSON' and paste the workflow code.

  2. Google Sheets Credentials: Locate the three Google Sheets n8n node instances (Get comments, Save comments, Update sentiment). Provide the necessary credentials and ensure you specify the correct Spreadsheet ID and Sheet Name for your operation.

  3. YouTube API Credentials: Configure the Get API Comments n8n node with your required YouTube Data API key and set up the video ID in the ID Video n8n node.

  4. Google Gemini/Langchain Credentials: Configure the Google Gemini n8n node with your appropriate API key to enable the AI capabilities required for the sentiment analysis n8n node.

  5. Activation: Ensure all connections are valid. Activate the n8n workflow by toggling the 'Active' switch, or test the entire process manually using the 'Test workflow' trigger n8n node.

Node Details

When clicking ‘Test workflow’ (Manual Trigger): Serves as the starting n8n trigger for testing and initiating the data collection process.
ID Video (Set n8n node): Essential n8n node used to define the specific YouTube video ID whose comments will be analyzed.
Get API Comments (HTTP Request n8n node): The crucial n8n node responsible for communicating with the YouTube Data API to fetch comment threads. Handles dynamic URL building based on the video ID and pagination tokens.
Multipage? (If n8n node): Implements flow control logic. This n8n node checks for the existence of a nextPageToken to determine if further API calls are required to complete the comment extraction.
Sentiment Analysis (Langchain n8n node): The core analysis n8n node. It leverages the provided text input (YouTube comments) and uses the connected language model to classify the emotional tone or sentiment.
Google Gemini (LM Chat Google Gemini n8n node): Provides the AI backend for the Langchain Sentiment Analysis n8n node. Ensures accurate and modern LLM-driven categorization.


  • Get comments / Save comments / Update sentiment (Google Sheets n8n node): These three instances of the Google Sheets n8n node manage the persistent data storage. They are used for retrieving unanalyzed comments, saving initial raw data, and finally updating the rows with the classified sentiment data.

Related n8n Workflows

Paid

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

Full-stack Web Developer based in Italy specialising in Marketing & AI-powered automations. For business enquiries, send me an email at [email protected] or add me on Linkedin.com/in/davideboizza

Featured*