Extract YouTube stats to Google Sheet
Pull channel, video, and playlist metadata to a Google Sheet using the YouTube Data API.
This solution includes a Google Apps Script that uses the YouTube Data API to extract information about channels and their videos and playlists. The script reads a list of channel IDs from a sheet, gets the channel metadata, and iterates through the videos and playlists of each channel and gets their own metadata. All information is saved into the sheet.
Easy to use
The script uses an initialization object that centralizes the names of the tabs, as well as the data keys to pull from YouTube. This makes it easy to make changes in the data you want to pull and store for channels, videos, and playlists.
You can configure a time-based trigger to have the script pull data periodically, or run it manually via a custom menu item or directly from the editor.
![](../img/youtube-data-code.png)
![](../img/youtube-to-sheet-channels.png)
YouTube channel data
When the script runs, it pulls the channel IDs from the "Channel IDs" tab and writes the metadata of each channel.
You can see in the code the various data elements that are available, and make modifications as you need.
YouTube video data
For each channel ID, the script pulls all the uploaded videos. It then displays the video metadata based on the columns specified in the code.
The script makes subsequent API calls to fetch more videos using "nextPage" tokens, similar to how search result pages work.
![](../img/youtube-to-sheet-videos.png)
![](../img/youtube-to-sheet-playlists.png)
YouTube playlist data
For each channel ID, the script also pulls all of the channel's playlists. It then displays the playlist metadata based on the columns specified in the code.
The script makes subsequent API calls to fetch more playlists using "nextPage" tokens, similar to how search result pages work.
BUY THIS PRODUCT
$45
The price is a one-time fee for the purchase of a script.
- Spreadsheet-bound Google Apps Script
- Unlimited script use
- Fully customizable
- Implementation instructions
- Free email support for 30 days