Quick overview
This workflow monitors a Google Sheets list of YouTube video IDs, fetches video details and top comments from the YouTube Data API, analyzes the comments with OpenAI into structured sentiment and themes, emails an HTML report via Gmail, and writes the results back to Google Sheets.
How it works
- Triggers every minute when a row in Google Sheets is added or updated.
- Reads the video ID and status from the row and continues only if the status is set to “Pending”.
- Calls the YouTube Data API to fetch the video’s metadata and the top comment threads for that video.
- Flattens the comment threads, calculates basic stats (comment count and average likes), and compiles a limited comment text block for analysis.
- If comments exist, sends the compiled comments and video title to OpenAI to generate a structured analysis (sentiment score, sentiment breakdown, themes, questions, feedback, insights, and summary).
- Builds an HTML email report from the structured results, sends it to the configured recipient with Gmail, and updates the Google Sheet row with the analysis fields; if no comments exist, marks the row as “No comments”.
Setup
- Create or duplicate a Google Sheet with at least “Video ID” and “Status” columns (plus the output columns you want to log, such as sentiment, themes, summary, and analyzed timestamp).
- Connect your Google Sheets OAuth credentials for the trigger and update steps, and set the correct spreadsheet ID and sheet tab.
- Provide a YouTube Data API v3 key and configure it as query authentication for the two HTTP requests to
www.googleapis.com.
- Add your OpenAI API credentials and confirm the model name in the configuration (for example,
gpt-5.4-mini).
- Add your Gmail OAuth2 credentials and set the recipient email address in the configuration values.
Additional info
Analyze YouTube video comments with AI and email a report
Need help customizing?
Contact me for consulting and support : Linkedin
MY NEW YOUTUBE CHANNEL
👉 Subscribe to my new YouTube channel. Here I'll share videos and Shorts with practical tutorials and FREE templates for n8n.
