YouTube Comment Sentiment Analyzer with n8n & OpenAI

Discover how to automate YouTube comment sentiment analysis using n8n, Google Sheets, and OpenAI. This workflow helps YouTubers save hours by extracting, analyzing, and storing comment sentiments effortlessly.
googleSheets
httpRequest
sentimentAnalysis
+5
Workflow Identifier: 1954
NODES in Use: manualTrigger, googleSheets, if, httpRequest, splitOut, lmChatOpenAi, sentimentAnalysis, set
Analyze YouTube comments with n8n and OpenAI

Press CTRL+F5 if the workflow didn't load.

Learn how to Build this Workflow with AI:

What this workflow does

This workflow reads YouTube video URLs from a Google Sheet and fetches recent comments automatically.
It sends each comment to OpenAI’s GPT-4o-mini model to analyze if the sentiment is Positive, Neutral, or Negative.
Then it saves the comments and sentiment back into another Google Sheet for easy review.
This saves hours of manual work reading and sorting comments, helping users see what viewers feel quickly.


Who should use this workflow

This workflow is for someone who manages multiple YouTube channels or videos.
It is useful if manually checking all comments takes too long or misses important feedback.

Anyone wanting fast, organized insights on audience feelings from many comments will benefit.
It works even if the user does not want to write code or handle APIs directly.


Tools and services used

  • Google Sheets: Stores the input video URLs and the output comments with sentiments.
  • YouTube Data API v3: Retrieves up to 100 recent comments for each video automatically.
  • OpenAI API with GPT-4o-mini model: Analyzes the sentiment of every YouTube comment text.
  • n8n: Automates the whole process inside a no-code workflow editor.

Inputs, processing steps, and outputs

Inputs

  • List of YouTube video URLs in a Google Sheet (with columns for last and next fetch times).
  • API credentials for Google Sheets, YouTube Data API, and OpenAI.

Processing Steps

  • Read video URLs and timestamps from Google Sheet.
  • Check if new comments should be fetched based on timing (to avoid repeated fetch quickly).
  • Call YouTube Data API to get up to 100 recent comments for each video.
  • Verify successful API response before processing.
  • Split comments into separate items for analysis.
  • Send each comment text to OpenAI GPT-4o-mini for sentiment classification into Positive, Neutral, or Negative.
  • Format necessary fields like comment ID, author, likes, replies, sentiment, and timestamps.
  • Insert new or update existing comments’ data in the Google Sheet.
  • Update the last fetched time and next fetch time in the Google Sheet for scheduling next runs.

Outputs

  • Google Sheet updated with comments details and sentiment labels for all monitored videos.
  • Timestamps updated to prevent unnecessary API calls.

Beginner step-by-step: How to use in n8n production

Download and import workflow

  1. Use the Download button on this page to get the workflow file.
  2. Inside the n8n editor, use the Import from File option to load the workflow.

Configure credentials and settings

  1. Add your Google Sheets Service Account credentials in the Google Sheets nodes.
  2. Provide your YouTube Data API key in the HTTP Request node Get Comments for video urls.
  3. Set your OpenAI API key in the OpenAI Chat Model node.
  4. Update the Google Sheet IDs, sheet names, or service account email if they are not set correctly.

Test and activate

  1. Click Execute Workflow to test if comments load and sentiment labels appear in your Google Sheet.
  2. Fix any errors like authorization or API quotas before continuing.
  3. Activate the workflow in n8n for scheduled or manual runs.

If you want automatic runs, replace the Manual Trigger with a Cron node and schedule frequency.
For users running self-host n8n, keep API quotas and timings in mind.


Edge cases and failures

  • Google Sheets access errors happen if you don’t share your sheet with the service account email. Give Editor rights for smooth access.
  • YouTube API errors mean wrong API keys, missing permissions, or quota limits. Check keys and console for quota usage.
  • OpenAI node may fail if the API key is wrong or prompts are misconfigured. Test prompts in OpenAI playground to verify.
  • If comment replies exist, they are not analyzed by default. This can be customized if desired.
  • The workflow will skip fetching when next_fetch_time is in the future to avoid repeats. Tweak timing logic if needed.

Customization ideas

  • Replace the Manual Trigger node with the Cron node to automate runs regularly.
  • Add more sentiment categories like Very Positive or Very Negative in the OpenAI prompt for finer results.
  • Increase maxResults parameter over 100 in YouTube API node if API quota allows for fetching more comments.
  • Include replying comment sentiment by looping through replies in comments and sending to OpenAI.

Summary of workflow results

✓ Saves hours per week by automating comment reading and sentiment detection.
✓ Organizes comment data and sentiment clearly in Google Sheets.
✓ Avoids repeated API calls by using fetch timing checks.
✓ Supports multiple videos managed at once via spreadsheet URLs.
✓ Easy to test and activate inside n8n with API keys and credentials.


Analyze YouTube comments with n8n and OpenAI

Visit through Desktop to Interact with the Workflow.

Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.
Author
Written By
Vikash Kumar
Building AI agents, n8n workflows and end-to-end automation for 30+ Brands across India, the US, Europe, Dubai & Australia. 7+ years of Experience saving founders real hours every week - no code required.

Frequently Asked Questions

The workflow uses last_fetched_time and next_fetch_time columns in Google Sheets to check if enough time passed before requesting new comments.
API requests will fail and return errors. The user must verify API keys, permissions, and quota usage in Google Cloud Console to fix this.
By default, the workflow does not analyze replies. It can be customized to include replies by modifying the comment-fetch and sentiment steps.
Sentiment labels with comment details are saved or updated in a Google Sheet, matching comments by commentId to avoid duplicates.

Related Workflows

Automate Twist Channel Creation and Messaging with n8n

This workflow automates creating and updating a channel in Twist and sending a personalized message to specific users. It eliminates manual setup errors and saves time managing Twist communications.

Automate Ideogram Image Generation with Google Sheets & Gmail

This workflow automates graphic design image generation via Ideogram AI, storing image data in Google Sheets and Google Drive, with email alerts via Gmail. It saves designers hours by automating image creation, remixing, review, and record-keeping.

Automate IT Support with Slack and OpenAI in n8n

Streamline IT support by automating Slack message handling using n8n and OpenAI. This workflow handles Slack DMs, filters bots, queries a Confluence knowledge base, and delivers AI-generated responses, improving support efficiency and response time.

Automate Crypto Analysis with CoinMarketCap & n8n AI Agent

Discover how this unique n8n workflow leverages CoinMarketCap’s multi-agent AI to deliver precise, real-time cryptocurrency insights directly via Telegram. Manage crypto data analysis efficiently with automated multi-source API integration.

Automate Gumroad to Beehiiv Subscriber Sync with n8n

Learn how to automatically add new Gumroad sales customers as Beehiiv newsletter subscribers using n8n automation. This workflow saves time by syncing sales data to Google Sheets CRM and notifying your Telegram channel instantly.

Generate On-Brand Blog Articles Using n8n and OpenAI

This workflow automates the creation of on-brand blog articles by analyzing existing company content using n8n and OpenAI. It extracts article structures and brand voice to produce consistent draft articles, saving significant content creation time.
1:1 Free Strategy Session
Your competitors are already automating. Are you still paying for it manually?

Do you want to adopt AI Automation?

Every hour your team does repetitive work, you're burning real money.
While you wait, faster businesses are cutting costs and moving quicker.
AI and automations aren't the future anymore — they're the present.

Book a live 1-on-1 session where we show you exactly which of your daily tasks can be automated — and what it’s costing you not to.