1
votes

This is a very general query - really I'm just looking for pointers to set me out on the right road.

In brief, I'm looking to generate realtime xml/rss feed(s) drawing from a Google Spreadsheet? Can I use Google Apps Script to generate this?

The Background: I have a proprietary CMS into which I want to pull in these rss feeds (I know how to do that!).

The content of the Spreadsheet would just be a few column-headings (Name, Short Desc, Keywords, Personal website URL). I want to be able to add content (rows) to the spreadsheet and, via the magic of RSS, have this content appear on the website via the feed.

I would really appreciate any pointers on how to achieve this. Thanks!

1
Would JSON be an acceptable format? - dev
Hi vletech, Yes JSON would be fine. I'll check the docs again to see if I can out more about this. Have you any other input on using JSON? Thanks. - user2291964

1 Answers

0
votes

Yes retrieving the data from a spreadsheet as JSON is relatively simple. Please see Google API documentation here which explains this. I've given a basic example below.

You simply add a <script> file to your webpage like below

<script src="http://spreadsheets.google.com/feeds/*TYPE*/*ID*/*WS*/public/values?alt=json-in-script&amp;callback=*FN*"></script>
  • Where TYPE is either list or cells. list provides the JSON data as each entry as a row and cells provices individual cells as their own entries.
  • Where ID is the spreadsheet's long ID.
  • Where WS is the worksheet number e.g. 1,2,3 etc.
  • Where FN is the function you want to call after the JSON data has been returned.

If you need the data to specifically be in XML format, then I've just quickly Googled and there are some pages that help with parsing between the two formats. Sorry I haven't any experience with XML so I can't help there.