Import YouTube RSS Feed(s) into Excel Using Power Query 👏
Introduction
If you’re a YouTube user, staying updated with content can be time-consuming, especially if you follow multiple channels. Automating this process using Excel allows you to track new video uploads efficiently. By leveraging Power Query, we can extract YouTube RSS feed data, transform it into a structured format, and integrate it into an Excel dashboard. This post walks you through the steps to achieve this and reviews the final Power Query M-code approach for a streamlined process.
What You Need to Get Started
To import YouTube RSS feeds into Excel, you need:
A YouTube Channel RSS Feed URL:
- Format:
https://www.youtube.com/feeds/videos.xml?channel_id=CHANNEL_ID
- Example:
https://www.youtube.com/feeds/videos.xml?channel_id=UC_x5XG1OV2P6uZZ5FSM9Ttw
- To find the Channel ID, visit the YouTube channel, inspect the page source, and search for
channelId=
.
Microsoft Excel (2016 or later)
- Power Query is built-in from Excel 2016 onwards. Earlier versions require the Power Query add-in.
Basic Understanding of Power Query
- Familiarity with data transformation and table manipulation in Excel will be helpful but is not required.
Step-by-Step Approach Using Power Query M-Code (Do It Yourself)
This approach follows a structured workflow, making the imported data cleaner and more readable in Excel.
Step 1: Define YouTube Channel Information
- Store static details such as the Channel Name, Channel URL, and RSS Feed URL in Power Query variables. This improves reusability when working with multiple channels.
Step 2: Load the RSS Feed into Power Query
- Use
Web.Contents(RSSFeedURL)
to fetch the XML data. - Convert XML into a table format using
Xml.Tables
.
Step 3: Extract Video Data
- YouTube’s RSS feed stores videos in an
entry
table. We extract essential details: title
(Video Title)published
(Upload Date)id
(Unique Video ID)
Step 4: Construct the YouTube Video URL
- Extract the unique
video ID
and append it tohttps://www.youtube.com/watch?v=
.
Step 5: Format and Structure the Data
- Convert the Published Date into a proper date format for sorting and filtering.
- Rename columns to be more readable.
- Remove unnecessary fields (e.g.,
id
). - Reorder columns for clarity.
Step 6: Load Data into Excel
- After applying transformations, Close & Load the data into an Excel table.
- The table updates dynamically when refreshed, fetching the latest video uploads.
Better…Have ChatGPT Create The Power Query M-Code for You
If you want to automate the M-Code creation process, you can use ChatGPT to generate a Power Query script for your YouTube RSS feed import. Below is an M-Code that I used ChatGPT create (edited by me) that achieves the same outcome:
let
// Step 1: Define YouTube Channel Information
ChannelName = "Excel Off The Grid",
ChannelURL = "https://www.youtube.com/@ExcelOffTheGrid",
RSSFeedURL = "https://www.youtube.com/feeds/videos.xml?channel_id=UCTx8QvRuF3BXTe5OIaVF9OA",
// Step 2: Load RSS Feed from YouTube
Source = Xml.Tables(Web.Contents(RSSFeedURL)),// Step 2: Load RSS Feed from YouTube
Source = Xml.Tables(Web.Contents(RSSFeedURL)), // Step 3: Navigate to the "entry" table (which contains video data)
Entries = Source{0}[entry], // Step 4: Extract relevant columns (Title, Published Date, and Video ID)
SelectedColumns = Table.SelectColumns(Entries, {"title", "published", "id"}), // Step 5: Generate Correct YouTube Video URLs from Video ID
AddVideoURL = Table.AddColumn(SelectedColumns, "Video URL", each "https://www.youtube.com/watch?v=" & Text.AfterDelimiter([id], ":video:")), // Step 6: Format Published Date
FormattedDates = Table.TransformColumns(AddVideoURL, {{"published", each DateTime.FromText(_), type datetime}}), // Step 7: Remove unnecessary columns
CleanedTable = Table.RemoveColumns(FormattedDates,{"id"}), // Step 8: Reorder columns for better readability
ReorderedColumns = Table.ReorderColumns(CleanedTable,{"title", "published", "Video URL"}), // Step 9: Rename columns for clarity
FinalTable = Table.RenameColumns(ReorderedColumns, {
{"title", "Video Title"},
{"published", "Published Date"}
})in
FinalTable
Steps Performed in the Code
- Fetches YouTube RSS feed data using
Web.Contents
. - Converts the XML structure into a table format.
- Extracts essential columns (
title
,published
,id
). - Generates YouTube video URLs dynamically.
- Converts the
Published Date
column into a proper date format. - Removes unnecessary columns to keep the dataset concise.
- Reorders columns for logical readability.
- Renames columns for better clarity and ease of understanding.
- Loads the structured table into Excel, ready for dashboard integration.
Benefits:
- Automated Code Generation: ChatGPT simplifies the process by generating Power Query M-Code, reducing manual effort.
- Customizable: Users can modify the script to track multiple channels.
- Dynamic Updates: Refreshing the table retrieves the latest videos without additional work.
- Optimized Data Structure: The script provides a structured and clean dataset for Excel-based reporting.
Review of the Final Power Query M-Code Approach
The Power Query M-code implementation effectively extracts, cleans, and presents YouTube RSS feed data in Excel. Here’s a summary of its advantages:
Automation
- No manual tracking of new uploads — simply refresh the table.
Structured Data Processing
- Extracts only relevant information (Title, Date, Video URL) for a concise dataset.
Clickability
- Automatically generates direct video links for easy access.
Flexibility
- Can be modified for multiple YouTube channels or further refined with additional transformations.
Compatibility with Excel Dashboards
- Supports PivotTables, charts, and conditional formatting for enhanced insights.
Conclusion
Integrating YouTube RSS feeds into Excel using Power Query is an efficient way to track new video uploads and maintain an up-to-date content repository. By following this approach, you can automate data retrieval, ensuring accurate and structured insights without manual intervention. Whether you’re monitoring a single channel or multiple ones, this method provides an automated, scalable, and user-friendly solution.
This was a amazing little project that, utilizing ChatGPT, was simple to create, modify as needed, and implement.
Give it a go yourself!