ADITYA R SHARMA

How to Extract all YouTube Channel Video Links to Google Sheet for FREE?

Using this hack, you can extract all YouTube Videos Links from any YouTube Channel and save them in Google Sheets.

If you are a content creator on YouTube, you know how important it is to keep track of your video links. However, manually copying and pasting each link into a Google Sheet can be time-consuming and tedious.

Fortunately, with App Scripts, you can extract all YouTube channel video links into a Google Sheet in no time. I have found App Scripts to be an incredibly useful tool. With just a few lines of code, I can extract all the video links from my channel and organize them in a Google Sheet. This not only saves me time but also allows me to easily share the links with my team and track the performance of each video.

If you require any customization, you can always connect with me.

Table of Contents

Requirements

To extract all YouTube channel video links into a Google Sheet using App Scripts, we will need the following:

  • A YouTube API Key
  • The YouTube Channel ID that you want to extract
  • A Google Sheet

The YouTube API Key is necessary to access the YouTube API and retrieve the video links. You can obtain a YouTube API Key by following the instructions provided by Google. The YouTube Channel ID is the unique identifier for the channel whose videos you want to extract. You can find the Channel ID in the URL of the channel page on YouTube.

The Google Sheet will be used to store the extracted video links. You can create a new Google Sheet or use an existing one. Make sure to have the necessary permissions to access and edit the Google Sheet.

Once you have the YouTube API Key, YouTube Channel ID, and Google Sheet, you can proceed to the next steps to extract the video links using App Scripts.

How to Get YouTube Data API Keys?

To get your YouTube API Key, you can follow the steps:

Login to Google Cloud Console

To get started with the YouTube Data API, you need to have a Google account. If you don’t have one, create a new account. Once you have a Google account, go to the Google Cloud Console and sign in with your credentials.

Create a New Project and Enable the YouTube Data v3 API

After logging in to the Google Cloud Console, create a new project by clicking on the “Select a project” dropdown menu on the top bar and then clicking on the “New Project” button. Give your project a name and click “Create”. Once your project is created, select it from the dropdown menu on the top bar.

Creating new Google Cloud Platform Project

Next, you need to enable the YouTube Data v3 API. To do this, click on the “APIs & Services” option in the left sidebar and then click on the “Dashboard” option. Click on the “Enable APIs and Services” button and search for “YouTube Data API v3”. Click on the “YouTube Data API v3” result and then click on the “Enable” button.

Enabling YouTube API

Create and Copy the YouTube API Credentials

Now that you have enabled the YouTube Data v3 API, you need to create and copy the API credentials. To do this, click on the “Create Credentials” button and select “API key” from the dropdown menu. Copy the API key that is generated, as you will need it later.

Getting API Key from YouTube

How to Get a YouTube Channel ID?

To get the YouTube channel ID, go to the YouTube channel page and look at the URL. The channel ID is the string of characters that comes after “channel/” in the URL. For example, if the URL is “https://www.youtube.com/channel/UCaXk_yWlCuLGYIJSohc0YOw”, then the channel ID is “UCaXk_yWlCuLGYIJSohc0YOw”.

Check the reference for my YouTube Channel from the image below

How to Find YouTube Channel ID

You can also use this tool to get Channel ID from a pretty channel links, example I will extract videos link from the famous Brian Dean’s channel, but when we open the channel we find – https://www.youtube.com/@BrianDean/ in the URL bar.

So, just paste the URL on the above website and it will show you the channel ID.

Copying Channel ID if you find it

Therefore, by following these steps, you can obtain your YouTube Data API keys and channel ID. With this information, you can use the API Connector and API Requests to extract all YouTube channel video links into Google Sheet using App Scripts. You can also filter the video links by title and parameters as needed.

How to Connect YouTube Data API with Google Sheets?

Connecting YouTube Data API with Google Sheets is a simple process that requires a few steps. Follow the steps below to connect the YouTube Data API with Google Sheets:

Creating the App Script Code in Sheets

The first step is to create an App Script code in Google Sheets. Here’s how:

  1. Open a Google Sheet and click on the “Extensions” menu.
  2. Select “App Scripts” from the drop-down menu.
  3. A new tab will open with a blank script.
chrome j0QQLq7SgL

After opening it, create a script and paste this code below

function listVideos() {
  // Replace CHANNEL_ID with the ID of the channel
  var channelId = "CHANNEL_ID";
  // Replace API_KEY with your API key
  var apiKey = "API_KEY";
  // Get the spreadsheet and the sheet
  var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = spreadsheet.getSheetByName("YouTube");
  // Set the API endpoint and parameters
  var endpoint = "https://www.googleapis.com/youtube/v3/search";
  var params = {
    part: "snippet",
    type: "video",
    channelId: channelId,
    key: apiKey,
    maxResults: 300,
    videoDefinition: "high",
    videoEmbeddable: "true",
    videoSyndicated: "true"
  };
  // Initialize the row index
  var rowIndex = 2;  // <-- Start writing the results from the 2nd row
  // Loop through all the pages of results
  while (true) {
    // Make the API request
    var response = UrlFetchApp.fetch(endpoint + "?" + buildQueryString(params));
    var data = JSON.parse(response.getContentText());
    // Exit the loop if there are no more results
    if (!data.items || data.items.length == 0) {
      break;
    }
    // Loop through the results
    for (var i = 0; i < data.items.length; i++) {
      // Get the video title and URL
      var title = data.items[i].snippet.title;
      var url = "https://www.youtube.com/watch?v=" + data.items[i].id.videoId;
      // Write the URL to the sheet
      sheet.getRange(rowIndex, 8).setValue(url);  // <-- Write the URL to the cell
      rowIndex++;
    }
    // Set the next page token
    params.pageToken = data.nextPageToken;
  }
}

// Helper function to build a query string from an object
function buildQueryString(params) {
  var query = [];
  for (var key in params) {
    query.push(encodeURIComponent(key) + "=" + encodeURIComponent(params[key]));
  }
  return query.join("&");
}

And you’re done with most of the work now.

Adding the Global API & Channel ID in Code

After pasting the App Script code, the next step is to add the global API and channel ID you have collected earlier.

Here’s how:

Replace CHANNEL_ID with the channel you want to collect links of, and API_KEY with the YouTube Global Data API you have generated from your Google Cloud console.

Make a Test Run of App Script

Once you have added the global API and channel ID, you can make a test run of the App Script. Here’s how:

  1. Click on the “Run” menu and select “listVideos”.
  2. Wait for the script to run. You should see a list of video links in your current Sheet Page
Extracting YouTube Links from Any YouTube Channel

If you want to extract other details like Video views, Video Title etc., then I would suggest you to my this blog where I talked about this using a different script.

Please have no hesitation to connect with me if you would like to collect any other details from YouTube API, I open for custom works.



I share my Learnings & Case studies via email.
Subscribe to Stay Updated

BONUS: How to Automate this using App Script Triggers

If you want to automate the process of extracting video links from a YouTube channel to a Google Sheet, you can use App Script triggers. Here’s how:

  1. In the App Script dashboard, click on trigger menu i.e. 3rd icon from top.
  2. Click on the “Add trigger” button in the bottom right corner.
  3. Set the trigger settings to the following:
    • Choose which function to run: listVideos
    • Choose which deployment should run: Head
    • Select event source: Time-driven
    • Select type of time based trigger: Hour timer
    • Select hour interval: Every hour
  4. Click on the “Save” button.
Enabling Time Based Trigger

With the trigger set up, the script will run automatically every hour and update the video links in the Google Sheet.

Conclusion

After going through the steps outlined in this article, I was able to successfully extract all YouTube channel video links into a Google Sheet using App Scripts. This process can be extremely useful for content creators, marketers, and anyone who wants to keep track of their favorite YouTube channels.

By using the YouTube Data API and Google Sheets, we were able to automate the process of extracting video links, titles, and other important information. This saves a lot of time and effort compared to manually copying and pasting links into a spreadsheet.

One thing to note is that the process may take longer for channels with a large number of videos. However, the script can be modified to run in batches to avoid exceeding the API quota limit. Additionally, the script can be customized to extract other types of data such as video descriptions, tags, and comments.

Overall, I found this to be a very helpful and efficient way to extract YouTube channel video links into a Google Sheet. With a little bit of coding knowledge and some patience, anyone can use this method to automate their YouTube data collection process.

Aditya R Sharma

Hello! Currently, I am working as Chief Marketing Officer at POSIMYTH Innovations, with a deep love for WordPress. I love solving problem with AI, Automations & Critical planning. In my free time, I write blogs to share all his learnings with the internet.

Content Writing for SaaS & WordPress Business
Tired of Low Traffic & see your Blog Fail?

Let me help you with content writing & SEO strategy for your product that makes sales.

After raising multiple domains to 1M+ organic click, I am helping Business owners like you harness the real power of SEO.

Explore Further