Using Google Sheets as an XML/RSS Datalinq Source

Configuring the Google Sheet

First, you will need to create some sort of sheet. For those who don’t know how to, it’s pretty simple. Go to drive.google.com, login with whatever credentials you have (if you have them). You will see a “New” button in the upper left hand corner. When you click on it, it will present you with options for new folders, as well as Google Docs types, including Google Sheets. Google Sheets is a rough equivalent to MS Excel.

Once you have created a new document, you can rename it, and create a simple sheet.

You will notice that I have a header for the columns of data. I did freeze the top row, because I believe once this outputs, it will use that data to name the elements in the XML.

Once you have a working sheet, it needs to be published to the web. This is what makes it publicly accessible for output as HTML, but also RSS and JSON.You’ll find this menu under File > Publish to web:

That will bring up this popup window:

And pressing the royal blue button in the middle is all you need to do.

You will not need to do anything with this link.

Construct URL for Datalinq Server

For XPression to read this data, you need to create a new RSS feed. You do this as you normally know how to do, but the URL needs some manual intervention to be constructed.

There are two main URLs you need to use to make the one useable URL. One is this template: https://spreadsheets.google.com/feeds/list/Workbook_Key/Sheet_ID/public/full

In addition you will need the actual link to the page that is your sheet.

In my example from above it is: https://docs.google.com/spreadsheets/d/1BS_CBp6tEk6dzlsKxHrfWwdNsdar4eda eo2oUbC53ug/edit#gid=0

The red string above is the “Workbook Key”. That is the string you will copy and paste into the green element from the first URL. The blue part, the “Sheet ID”. This is the index number of the sheet in your whole workbook. So if you have multiple tabs at the bottom, the first one is 1, second one is 2, and so on.

Since I only have one sheet, I’m using Sheet ID 1.

So a properly constructed URL for Datalinq would look like this: https://spreadsheets.google.com/feeds/list/1BS_CBp6tEk6dzlsKxHrfWwdNsdar4e daeo2oUbC53ug/1/public/full

That is the format of the URL you will copy into the RSS feed for Datalinq Server. That link will give you the feed as XML. It is possible to output the format as JSON as well, though I have yet to see a difference once it gets to XPression. Though if you wanted to try it with the new JSON functionality, you would append “?alt=” to the URL.

It would then look like: https://spreadsheets.google.com/feeds/list/1BS_CBp6tEk6dzlsKxHrfWwdNsdar4e daeo2oUbC53ug/1/public/full?alt=json

At this point, everything about Datalinq is the same is it is regarding an XML file. Every row is considered an “entry”. Inside each entry is various elements. However there is also the column data for each row. The element names appear to be something like “gsx:columnname” where columnname is what you typed into the header in the sheet. So for me that I have gsx:firstname, gsx:lastname, gsx:uniform, gsx:year, and gsx:fullname.

I should note that I used a concat function in the spreadsheet, much like other Excel users use, and it does flatten the string to the appropriate text. So you can do some processing in the spredsheet before it hits XPression.

Another thing I noticed was that when I imported an XLS file into Google Sheets and then converted it to a native Google Sheet, the data formatting got a little weird. Instead of the element containing the data, it created a child attribute called t$ that contained the data. The only problem with that is that you can’t do XML searches like you can with the element containing the data. I found that if you created a sheet from scratch, it doesn’t have that problem. But in both cases, everything will work.

Good luck, and happy experimenting with this!

Chris Kelly