Follow by Email

Saturday, September 10, 2011

How to pull Blogspot Data in Google Docs

It is really an interesting application, which pulls Blogspot details from Rss or Page source. Yahoo Pipes is the one of the online web application which used to mashups the web feeds and web contents. Since it is a graphical interface we can drive pipes as much as we imagine and we can use the output feeds in varies forms with help of Javascript. I was searching for an alternate for Yahoo pipes for pulling the blog details, and accidentally met Google Docs. Basically, Google Docs serves as storage device for resource with real time collaboration, Google apps script is the key which plays vital role in such development. In this article I have shared a technique which can be a tutorial for Google apps script for Pulling data from blogspot

Goto Google spreadsheet,
To view Script editor, go to Tools->Script Editor
Just copy paste the below codes and run the Script

function rumme() {
var line = "2";
var mySheet = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
var range = mySheet.getRange(1,1);
var bname= "macrolayer";
var burl = "http://" + bname + "";
response = UrlFetchApp.fetch(burl);
xml = Xml.parse(response.getContentText(), false);
root = xml.getElement(); // feed element
var btitle = root.getElement("title").getText(); //blog's Title
var bdes = root.getElement("subtitle").getText(); //Description
var blink = root.getElements("link")[2].getAttribute("href").getValue(); // Url address
var blogr = root.getElement("author").getElement("name").getText(); //Author name
var blogid = root.getElement("author").getElement("uri").getText(); //Author Profile url
var blogmail = root.getElement("author").getElement("email").getText(); //Author email address
var bupdated = root.getElement("entry").getElement("updated").getText(); // last updated date
This Script will pull the Title, description, Url, so and so as in image. you can use for look to get more blogs details at the time. You can change the colored string to your wish. 
Above is the Basic sample Code for pulling the Blogs details, You can change Feeds url and its attribute for other sites. And check the every element of the blogs feed before pulling it