How to Track YouTube Videos View Count in Google Sheets

0 Comments
Editor Ratings:
User Ratings:
[Total: 0 Average: 0]




This tutorial explains how to track YouTube videos view count in Google Sheets. Here I will mention two simple methods to do it. In this post, I will talk about a simple script and a Google Sheet add-on to fetch publicly available information about a YouTube video though its video ID. And not only views, but you can also see some other stats as well such as likes, dislikes, duration, thumbnail, etc.

If you have a YouTube channel and wants to keep track of views you get on all videos, then one of the best ways to do that is from Google Sheets. Even though, you can do the same thing using YouTube Analytics but, in case you use Google sheets more often then the methods I have mentioned here will be much handier.

How to Track YouTube Videos View Count in Google Sheets

How to Track YouTube Videos View Count in Google Sheets?

YT Tracker:

YT Tracker is a free Google Sheets add-on to create a YouTube tracker sheet with public details of the video. It takes YouTube video ID as an input and fetch number of views it has instantly. Not only this, but it also fetches other additional information about the video such as number of likes, dislikes, published date, thumbnail, and duration. The add-on is completely free, and you can fetch and track all the aforeme4ntioned data about any YouTube video instantly.

The video data it fetches for you will always stay updated when you open the sheet. You can even share the sheet with anyone you like. Also, apart from fetching information about a random YouTube video, you can use this add-on to fetch stats of videos in your own YouTube account.

Here are the steps to get started with this GSheet add-on to track YouTube videos.

  1. Go to the Google Workspace Marketplace here and then install this add-on. Authorize your Google account and let it access our YouTube data.
  2.  Now, you can find this in the Add-ons menu of your Google Sheets.
  3. Open a new Google Sheet. Use Add-ons > YT Tracker: YouTube Stats & Analytics > Track YouTube Videos option to create a YouTube tracker template in the sheet.
    YT Tracker Addon Menu
  4. Now, it is all ready to work. You just enter the YouTube video IDs in the first column. You can enter as many IDs you want in each row of the first column, and it will immediately fetch you details of the video instantly.
    YT Tracker in action

In this way, you can use this simple Google Sheets add-on to track how many people watch your YouTube videos. Apart from video views, other parameters will also be kept updated and there are some other options in the add-on that you’d like to use. This add-on can also show some other statistics about the YouTube videos, but you will have to enable from the add-ons configuration page.

Track YouTube Watch Count using a Google Apps Script:

The add-on, I have mentioned above, works fine and will be enough for your needs. But if you only want watch count and as a formula that you can use it in any sheet, then you can use the following script to do that. Google Apps Script comes with support of YouTube API and can be used as follows.

  1. Go to Extensions > Apps Scripts. Paste the code below and save.
    function onOpenFunc() {
    PropertiesService.getScriptProperties().setProperty("accessToken", ScriptApp.getOAuthToken());
    }
    /**
    * Gets the YouTube video view count using Video Id.
    *
    * @param {string} videoid The video id.
    * @return View count
    * @customfunction
    */
    function getVideoViews(videoid) {
    var accessToken = PropertiesService.getScriptProperties().getProperty('accessToken');
    
    var videoStats = YouTube.Videos.list('statistics', {'id':videoid, 'access_token':accessToken}).items[0].statistics;
    return [[videoStats.viewCount]]
    }

    Code in script editor

  2. Go “Services” and find YouTube Data API v3 and turn it on.Enable YouTube API GSheet
  3. Click on project’s Triggers From the left side, click Add Trigger and set it up like I have shown below. After you save the trigger, it will ask you to authorize it via your Google account, so do that and let it access your YouTube account. Finally, go back to the spreadsheet and refresh the browser tab.
    Add Trigger to App Script project
  4. Use formula getVideoViews() with YouTube video id in parentheses in any cell of the Google Sheet. For example, consider the video: https://www.youtube.com/watch?v=2Ws_5-hiqao you would use the function as: getVideoViews(“2Ws_5-hiqao”)
    App Script Getting YouTube Video Views in Action

If you want to add commas to thousands and million places, then use this formula instead: =TEXT(getVideoViews(A2) ,"#,0")

This is another handy method to get the watch count of any YouTube video. Just use the script and let it work on its own. Just like the add-on I mentioned earlier, it will also make sure that view count stays updated in the sheet.

Closing thoughts:

If you are owner of some YouTube channel and want to keep track of the views you get on your videos in Google Sheets, then you are at the right place. I have mentioned 2 very simple methods to do it. Use whichever you find easier. Both these methods are great and will always give you an updated sheet containing number of views on videos right from your YouTube channel or any other channel.

Editor Ratings:
User Ratings:
[Total: 0 Average: 0]

Leave A Reply

 

Get 100 GB FREE

Provide details to get this offer