IMPORTFEED function in Google Sheets can be used to import the RSS feed in the worksheet.
This can be useful if you want to keep track of new blog posts or news items on your favorite website. For example, you can create a list of websites that you want to follow and quickly get the updated list of new at one place.
This Article Covers:
IMPORTFEED Function – Syntax
Here is the syntax of IMPORTFEED in Google Sheets:
IMPORTFEED(url, [query], [headers], [num_items])
- url – this is the URL of the RSS or ATOM feed of the website. Note that you need to add the http:// or https:// protocol to the before the website URL. Also, the URL must be within the double quotes.
- [query] – this is an optional argument where you can specify what you want to fetch from the feed. For example, you can fetch the Title of the post, the summary, author, etc. In case you don’t specify this argument, it would fetch all the details from the feed.
- [headers] – this is an optional argument where you can specify whether you want the headers or not. If you make this TRUE, the function would automatically add a row at the top that will have the headers. By default, it is FALSE.
- num_items – this is an optional argument where you can specify the number of feed items you want in the result. For example, you can use 5 to get the latest five posts from the feed. If it’s not specified, all the items from the feed are extracted.
Now let’s have a look at some useful examples of using the IMPORTFEED function in Google Sheets.
Example 1 – Fetching all the Items from the feed URL
Suppose you want to get the latest blog posts on Tech Crunch website (which is one of the popular tech sites).
Here is the formula that will fetch the items from the feed of Tech Crunch:
Note that I have provided two arguments in the above formula:
- the URL of the feed
- TRUE for headings so that the results would show an additional row that has the heading.
Below is the result output.
I can also have the URL in a cell and use the cell reference in the formula.
Suppose I have the feed URL of Tech Crunch in cell A1, I can use the below formula:
Here is the result output:
Note that the default number of items that you get in the worksheet would vary depending on the feed settings. For example, in the case of Tech Crunch, the above formula would return 20 items, as that’s what has been set by the webmaster of Tech Crunch. On the other side, I have set 10 items as default for Productivity Spot, and hence the formula would only return the latest 10 posts.
Example 2 – Fetching a Specified Number of Items from the feed URL
In the above example, the formula extracted all the items in the feed.
However, if you want to fetch only the latest five or latest 3 posts, you can do that specifying it in the formula.
Here is the formula that will fetch the top five results from the feed:
In the above formula, I have specified the number of items as 5 (which is the last argument of the formula).
Note that if you specify a number that is more than that of the number of items in the feed, it will return the default number only. For example, in this Productivity Spot’s feed, the maximum number of items to be displayed is set to 10. Even if you make the num_items argument as 20, it will still show only 10 feeds.
Example 3 – Fetching a Specific Items from the feed URL
You can also specify what items you want from a feed. For example, you may only want the post title or the post URL and not the other columns (such as author, date created, and summary).
Here is the formula that will fetch the post title from the feed URL:
The “items title” part of the formula returns the post titles of the items in the feed.
The output will look as shown below:
Note that you can not specify multiple queries in the same formula. So for example, if you want the post title in one column and post URL in second, you need to use two separate IMPORTFEED formulas.
Here is the formula that will return the URL from the feed:
Template to Keep Track of New Posts in Google Sheets
You can use the IMPORTFEED function to create a template that will quickly show you the latest posts from your favorite websites.
For example, if you want to keep track of the latest posts from major websites, you can create a table with the site name, and it’s feed URL (as shown below):
Note that the feed URL may differ for websites. Major websites often list their feed URL on their website.
Now, on a separate sheet, you can create a drop-down that shows the names of these websites (as shown below).
Adjacent to it, you can use the IMPORTFEED formula to fetch the feed title and URL. Below is the formula I have used to get the feed title:
=IMPORTFEED(VLOOKUP(A1,'Website Names'!$A$2:$B$6,2,0),"items title",TRUE,10)
I have used the VLOOKUP formula to fetch the feed URL based on the website name (the table array for the VLOOKUP function is on another sheet ‘Website Names’). This URL is then used in the IMPORTFEED function to fetch the titles.
Similarly, another IMPORTFEED function is used in the adjacent cell to fetch the post URL from the feed.
You can read more about the IMPORTFEED function here.
You May Also find the following Google Sheets Tutorial Useful: