Import YouTube Analytics Data to Google Sheets

This guide will show how to pull private YouTube video data (data you need to be logged in to view) directly into Google Sheets, using the API Connector add-on for Sheets.

In general, YouTube's Public Data API is better developed and easier to work with than their Analytics API, so if you only need simple data like views, comments, and likes, I suggest checking this article instead. But if you want private video metrics for your own channel, like average watch time, views by date, and demographic breakdowns, read on for a step-by-step guide to the YouTube Analytics API.


Before You Begin

Click here to install the API Connector add-on from the Google Marketplace.

Part 1: Connect to the YouTube Analytics API

The easiest way to get started with the YouTube Analytics API is through API Connector’s built-in integration.

  1. Select YouTube Analytics from the drop-down list of applications
  2. Under Authorization, click Connect to YouTube
  3. You will see a couple of screens asking you to log in and approve the connection. Click Allow.
  4. You'll then be returned to your Google Sheet, and can verify that your YouTube connection is active.

Part 2: Pull YouTube Analytics Data into Sheets

Now that we’re connected, let’s pull some data into Sheets.

  1. Under Endpoint, choose whether you'd like to fetch data about your channel overall or stats for the individual videos in your channel. We'll start by getting video data.
  2. Fill in any required parameters. For the videos endpoint we need to populate the start Date, endDate, maxResults, metrics, AND sort parameters.
  3. Optionally set the filters parameter to select specific data points for the response.
  4. Select a destination sheet, name your request, and click Run.

Part 3: Create a Custom API Request

Alternatively, you can run your own custom requests instead of using API Connector’s pre-built integration, using any of the API URLs shown in the API documentation.

To create a custom request, add your complete URL into the Request URL field, and choose YouTube from the OAuth menu. Here's an example request setup:

Example #1 - Channel Report

  1. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  2. In the request form enter the following:
    • ApplicationCustom
    • MethodGET
    • Request URL,views,likes,subscribersGained&ids=channel==MINE&startDate=2022-01-01&endDate=2022-12-31&maxResults=200
    • OAuthYouTube
  3. When you select YouTube from the OAuth menu, you'll see a blue Connect button if you haven't already authorized the connection. Click through to enable the connection.
  4. Create a new tab and click Set current to use that tab as your data destination.
  5. Name your request and click Run. A moment later you’ll see statistics about your channel's videos populate your sheet.

Example #2 - Revenue Report

If you have a monetized channel and access to a Content Manager account, you can fetch additional revenue-related metrics for your YouTube account.

  1. Verify that you have a YouTube Content Owner account. A YouTube Content Owner is not the same as a YouTube channel. Typically, you only have a YouTube Content Owner account if you manage many different channels.
  2. Get your Content Owner ID.
  3. Get your YouTube Channel ID.
  4. Open up Google Sheets and click Extensions > API Connector > Open > Create request.
  5. In the request form enter the following, filling in your own content owner and channel IDs:
    • ApplicationCustom
    • MethodGET
    • Request URL,estimatedAdRevenue,grossRevenue&filters=channel==your_channel_id
    • OAuthYouTube
  6. When you select YouTube from the OAuth menu, you'll see a blue Connect button if you haven't already authorized the connection. Click through to enable the connection.
  7. Create a new tab and click Set current to use that tab as your data destination.
  8. Name your request and click Run. A moment later you’ll see statistics including revenue-related data populate your sheet.

Part 4: Handle Pagination

Let's get it out of the way immediately, this section doesn't contain a real way to handle pagination. You can set the maxResults parameter to 200, but this API doesn't support paginating through results to retrieve more than 200 records at a time. If you have more than 200 videos, you can try using the filters parameter to break your data up such that it can be retrieved in groups of less than 200 at a time, and then run those request URLs separately.

Part 5: YouTube Compliance

To comply with the terms of YouTube's API, requests are subject to the following conditions:

  1. All saved requests to YouTube will refresh every 30 days, even if you have not set up a scheduled refresh.
  2. All YouTube requests will show only the metric name rather than the full path in the header row.

Relevant Terms:

API Clients may store all other types of Authorized Data not identified in section (III.E.4.b) for as long as is necessary for the purposes of the specific consent granted by an active user and for no longer than 30 calendar days. After 30 calendar days, the API Client must either delete or refresh the stored data”. (link)

"Your API Clients must not (i) replace API Data with similar, independently calculated data, or (ii) access or use API Data to create new or derived data or metrics." (link)

Part 6: API Documentation & Resources

Many sample queries are provided in YouTube's list of sample requests. In addition, they provide an API Explorer tool that simplifies the process of testing and constructing queries.

Related documentation:

  • The YouTube Analytics API (the subject of this article) allows you to query private statistics about your channel, like video watch times and demographic breakdowns. Documentation:
  • The YouTube Public Data API allows you to retrieve lists of content based on search parameters. It also provides some basic statistics like views, likes, comment counts, and subscriber counts, for all public videos. Documentation:
  • The YouTube Reporting API is focused on reporting, and provides bulk reports of YouTube analytics data for your own channel, including detailed metrics and ad performance reports. Unlike the Analytics API, it doesn't provide filtering and sorting parameters, as these reports are designed to be downloaded and stored in a data warehouse, where you can then query the data yourself. (This table provides a summary of the differences between YouTube's Reporting and Analytics APIs). Documentation:

18 thoughts on “Import YouTube Analytics Data to Google Sheets”

  1. First of all, thank you so much for this amazing tool!

    I am, however, running into some trouble with pagination for the Youtube analytics API using the "video" dimension (whole request is below). I simply want to retrieve data for all videos on my channel. Do you know what settings I should use in order to get pagination working?,estimatedMinutesWatched,likes,dislikes,averageViewPercentage,averageViewDuration&sort=-views&startDate=2014-01-01&endDate=2061-12-31&maxResults=200&ids=channel==MINE

    Kind regards.

    • The docs show the startIndex / maxResults parameters, but it seems like these still don't let you paginate beyond 200 total results. I'll update the article to reflect that.

  2. Absolutely amazing article! hi there thanks for sharing this piece of information with us, I was looking for something like this as importing the data is an important part of analyzing a video's performance. Thanks again for sharing it with us. you really eased my task.

  3. Hi - this is the tool I've been looking for! But I can't seem to get more than 1 dimension at a time to work. I would like to get view counts by video by day (actually, I'd like by Country as well, but let's just get two working for now!)

    This is what I have:,views,likes,subscribersGained&ids=channel==MINE&startDate=2020-01-01&endDate=2021-12-31

    The above works fine.,video&metrics=estimatedMinutesWatched,views,likes,subscribersGained&ids=channel==MINE&startDate=2020-01-01&endDate=2021-12-31

    But if I add in video it errors. in the docs 'video' seems to be a valid dimension, but it doesn't work when I use it in the API. Please help! 😉

    • Good question. Unfortunately the YouTube API is really outdated and doesn't provide a lot of data points that people would obviously be interested in, for example video views per day. As far as I can tell YouTube doesn't permit this combination. It's not clearly written in their docs, but their examples don't show this combination and I see other people asking this same question online (e.g. here, here)

      So I think you can only get this by pulling dates one by one, like this:,views,likes,subscribersGained&ids=channel==MINE&startDate=2021-05-23&endDate=2021-05-23&maxResults=200

      Then you would need to repeat that for each day. Obviously that's not ideal, but you could list these one after the other or reference cells in the sheet to make this a bit more convenient (info).

    • Hi Mark,
      I found a workarround for the problem. You need to create a second table with a list of all video IDs (Maybe use a more general request with the API Connector) and then add a filter parameter to your first request like so: &filters=video==+++!videoIDsA2:A+++
      The information between the +++ is the column with the Video IDs so the Connector makes new requests for each video in the list.
      Hope this helps a bit.

  4. Thanks so much for your reply!

    Well, at least it's not me doing something wrong...but it is surprising that (what I consider to be) the primary Use Case isn't supported by the API...

    Maybe I can get something like Postman to run it multiple times with changing dates?

    • Yeah it's pretty weird, their API doesn't support key use cases and has strange limits. You can definitely run it in Postman by manually changing the dates and re-running, but I'm not sure if Postman has an automatic feature to cycle through requests like API Connector does.

  5. Hi, I would like to get the past 7 days worth of stats. Is there a way that I can set the start date as dynamically 7 days ago? Or some other kind of work around?

      • Hi Ana. I'm trying this again.

        On a sheet "QuerySheet"
        B2 is 22 Jan 2022 through formula: =text(today()-6,"yyyy-mm-dd")
        C2 is 28 Jan 2022 through formula: =text(today(),"yyyy-mm-dd")

        I'm using this API URL:,comments,likes&ids=channel==MINE&startDate=+++QuerySheet!B2+++&endDate=+++QuerySheet!C2+++&maxResults=200

        This works and gives me back 21 for the views which is only stat I want for now.

        But... when I look at the analytics on the site, it tells me there were 61 views in the same period.

        If I change C2 to "=text(today()-1,"yyyy-mm-dd")" I get 25. This makes it 27 Jan 2022.

        YouTube Analytics says there were 27 views on 27th.

        What do you think?

        Thanks for your help so far.

      • I just tested and it looks like the API has a 2 day latency. That's definitely longer than I expected so I don't know if it's always that delayed, but I'm getting 0 views for yesterday and the day before, and accurate view counts for every day before that. So you'll need to set your formula to today()-2 or, depending on your timezone, maybe even today()-3 to match the data shown in the interface.

  6. Hi, I'm trying to use the API, but it's hanging on the first step when I click "Connect" been about 10 mins, how long should this take to being up the permissions sheet?

    • Hey there, this issue is related to being logged into Google with multiple accounts. To resolve, please log out of all your Google accounts and then log back in first with the account you use with API Connector, or log in with a new profile or incognito window.

  7. Did anyone try fetching channel information like subscribers, uploads & video views? Would be interesting for competitive research. There must be a public API as well?

    • I can't think of any reason they would show zero if they have data. YouTube Analytics can have a long latency period (2-3 days) before fresh data appears, are these metrics populated when you fetch data from an earlier time period?


Leave a Comment

Jump To