Parse XML RSS Feeds with Google Apps Script in Google Sheets
RSS (Really Simple Syndication) is a web feed format used to publish frequently updated information like blog entries, news headlines, or podcasts. If you want to fetch and display RSS feed items automatically inside Google Sheets, Google Apps Script is the perfect tool.
This tutorial shows you step-by-step how to fetch, parse, and display RSS feed items using custom Google Apps Script code in a spreadsheet.
Track news headlines from multiple sites in one place
Monitor blog updates for content curation
Fetch YouTube video titles from RSS feeds
Create custom dashboards for clients, research, or marketing teams
Google Sheets makes it easy to organize and filter feed data, while Apps Script gives you automation power without any extra software.
Open a new Google Sheet.
Click on Extensions > Apps Script.
Delete the default myFunction().
Here's a sample script that parses RSS feed XML and displays titles, links, and dates.
function fetchRSSFeed() {
const sheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
const feedUrl = 'https://www.nasa.gov/rss/dyn/breaking_news.rss'; // Change this to your desired RSS feed URL
const response = UrlFetchApp.fetch(feedUrl);
const xml = XmlService.parse(response.getContentText());
const root = xml.getRootElement();
// Navigate to the <channel> element
const channel = root.getChild("channel");
const items = channel.getChildren("item");
// Clear previous data
sheet.clearContents();
sheet.appendRow(["Title", "Link", "Published Date"]);
// Loop through RSS items
items.forEach(function(item) {
const title = item.getChild("title").getText();
const link = item.getChild("link").getText();
const pubDate = item.getChild("pubDate").getText();
sheet.appendRow([title, link, pubDate]);
});
}
Click the Run ▶ button in the Apps Script editor.
Authorize the script when prompted.
Switch back to your spreadsheet and you'll see the RSS feed items loaded.
Replace the URL in this line:
const feedUrl = 'https://www.nasa.gov/rss/dyn/breaking_news.rss';
with any valid RSS feed like:
BBC News: http://feeds.bbci.co.uk/news/rss.xml
The Verge: https://www.theverge.com/rss/index.xml
YouTube Channel: https://www.youtube.com/feeds/videos.xml?channel_id=CHANNEL_ID
Note: Always verify the feed is accessible and formatted properly.
You can extract additional elements:
const description = item.getChild("description").getText();
const author = item.getChild("author") ? item.getChild("author").getText() : "";
And include them in your sheet:
sheet.appendRow([title, link, pubDate, description, author]);
Some feeds use namespaces, so you need to parse with them like this:
const namespace = XmlService.getNamespace("yt", "http://www.youtube.com/xml/schemas/2015");
const channelId = root.getChild("channel").getChild("channelId", namespace).getText();
Make it user-friendly by adding a custom menu:
function onOpen() {
const ui = SpreadsheetApp.getUi();
ui.createMenu("RSS Tools")
.addItem("Fetch Latest RSS Items", "fetchRSSFeed")
.addToUi();
}
Now users can click “RSS Tools > Fetch Latest RSS Items” directly from the sheet.
You can fetch updates every hour or day:
In Apps Script editor, click the Triggers icon (⏰).
Click + Add Trigger.
Choose function: fetchRSSFeed
Select event source: Time-driven
Choose interval (e.g., every hour)
Now your feed updates automatically!
News Dashboard: Monitor several news outlets on one sheet.
Content Research: Track competitors’ blog posts.
YouTube Publishing: Monitor latest uploads from a list of channels.
Podcast Tracker: List new episodes from your favorite shows.
| Error | Cause | Fix |
|---|---|---|
Cannot read property 'getText' of null |
The XML element is missing | Use a conditional check before calling .getText() |
Exception: Invalid XML |
Malformed feed or non-XML URL | Verify the RSS feed URL is correct |
| Nothing shows up | Namespace conflict or wrong element name | Inspect the raw XML in browser, adjust tag access accordingly |
Parsing XML RSS feeds with Google Apps Script is a powerful way to turn a plain spreadsheet into a live content feed dashboard. Whether you’re a content marketer, journalist, analyst, or developer, this method saves time and gives you full control of feed data inside Google Sheets.
With just a few lines of code, you can automate feed parsing, customize your columns, and integrate data from multiple websites — all inside the familiar spreadsheet interface.