YouTube Stats Daily Email reporter – Youtube API & Apps Script

Written by
  • how to
  • Tech

There are many ways that you can use your Youtube Analytics Data,  YouTube’s Api, allows you to fetch your Uploads data for your convenient use.

In this post, we will see a simple example to create a Youtube Reporting sheet that will be updated  and emailed to you on a daily basis.  And the greatest thing is that we’re gonna use Google Sheet, and Apps script.



Click on the image to see how your stats sheet will look like:

youtube stats reporting google sheet

We have two main function in this dashboard:

youtube stats functions


You can find the code for this example on my github.

Download the JS file from here.


How to set up this stats sheet?

  • Create the new sheet in your Google drive, you can name it whatever you want
  • In the menu, click on tools , script editor:
    tools script editor
  • When prompted click on: Create script for: BLANK PROJECT
  • Erase everything written, and replace it with the content of the JS file from here.
  • Click on save, and name your project what ever you want
  • In the menu, click on Run, and select OnOpen
  • It will ask you for  Authorization, click on continue and authorise
  • In menu click on resources  and select Advanced Google Services
  • Scroll down and turn  YouTube Data and YouTube Analytics API on
    example ultgate api
  • Once again click on Resources, then on Developer Console project, then click on the name of your project
    developer consol project
  • It will open you Project Dashboard, on the left sidebar click on APIs & auth, then on APIs
  • Under YouTube APIs  click on YouTube Data API  and Enable Api, then go back and click on  YouTube Analytics API and click on enable API
  • Once you’re done enabling the APIs, close the project dashboard and go back to your script
  • Click on >>  run >> OnOpen, and authorize the script to your account.
  • Again click on run>> OnOpenit up

Congrats you’re done setting the script, now go back to your sheet, and click on Youtube Dash >> Update Stats, and it will generate the report for you

Let’s setup the email report now!

  • Just write your email in Column H, Row 3.
  • Click on YouTube Dash >>Send Report Now , to test sending email
  • If all works fine go back to script editor,click on Resources >> All your triggers
  • And set it up like the image below:
    triggers setup
  • Then save and you’re done!