Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google Spreadsheet to RSS ATOM - Google Apps Script
function doGet(e) {
var rss='<?xml version="1.0" encoding="utf-8"?>';
rss+='<feed xmlns="http://www.w3.org/2005/Atom">';
rss+='<title>Frases y citas célebres - NexCono </title>';
rss+='<link href="http://nexcono.appspot.com"/>';
rss+='<author><name>NexCono</name></author>';
rss+='<id></id>';
var app=SpreadsheetApp.openById("1tLSL5BqnTAM6VsgyF355DJJe50r0ZQbfunTXAUFj_nE");
var data=app.getDataRange().getValues();
var lastTime;
for(var i=1;i<data.length;i++){
var date=new Date(data[i][0]);
//Logger.log("DATE: "+date.toISOString());
//Logger.log("AUTOR: "+data[i][2]);
rss+='<entry>';
rss+='<title>Frase de '+data[i][2]+'</title>';
rss+='<content>«'+data[i][1]+'» - '+data[i][2]+'</content>';
rss+='<summary>«'+data[i][1]+'» - '+data[i][2]+'</summary>';
rss+='<link rel="alternate" href="http://nexcono.appspot.com"/>';
rss+='<id>http://nexcono.appspot.com/frase/'+date.toISOString()+'</id>';
rss+='<updated>'+date.toISOString()+'</updated>';
rss+='</entry>';
lastTime=date.toISOString();
}
rss+='<updated>'+lastTime+'</updated>';
rss+='</feed>';
return ContentService.createTextOutput(rss).setMimeType(ContentService.MimeType.ATOM);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.