Thursday, September 19, 2013

Post to Blogger from Google Spreadsheets

This quick tutorial will show you how I set up my Blogger blog (you could also use Twitter feed) to update automatically from my Google Spreadsheet.  I use this method because Blogger and Twitter are setup using separate accounts that are a hassle to access, so it's easier just to update the Google Spreadsheet under my one primary account.  This method also uses the wonderful IFTTT.com service.

First, you need to setup your Google Spreadsheet. Create a new spreadsheet and set it up similarly to this one:


 Then select File>Publish to the Web. You can select which sheets to publish. I have chosen just to publish the first sheet, as this works best. Make sure "Automatically republish when changes are made" is checked. This feature continuously updates the feed every time you make a change. (Note: Sometimes it does take a few minutes to update.) Click "Start Publishing" to begin. If you ever want to stop updating, you can click "Stop Publishing." (Note: you can manually update your feed by clicking "Republish now" if you need to.)



Under "Get a link to the published data," select "ATOM." Then select "List" and leave the default "All cells." If you select "Cells" then each individual cell will show up as a separate RSS item.

The "List" feature selection will publish each row as a separate RSS feed item. More on this below...

Grab a copy of the link Google generates. You'll use this link on IFTTT.

If you copy and paste the link into your browser, it will look like a mess (unless you look at it in Internet Explorer or some browser that sees RSS feeds easily).


Viewing in Chrome, it looks like a mess, because it's just raw RSS code...
Viewing in Internet Explorer, it looks nice, since it is formatted properly as a RSS feed
The original Google Spreadsheet

A few things to note: If you look at your feed in IE to see it properly formatted and compare it to your Google Spreadsheet, you'll notice that the cell in A2 will be the title of your item and that the contents of cell B2 will be your post's content. The Google Spreadsheet actually mashes all contents past column B into the content. So, if you also had content in cell C2, that would show up together with the B2 cell's contents in the post's content. You'll also notice that the contents of row 1 act as a title row. So for the content section of the post, it takes the title from B1 and prepends that to the contents of B2 to form the post's content. Same thing with C1 and C2, D1 and D2, etc. All your posts will get the row 1 title prefix. If you leave row 1 empty to avoid this, Google will add some funky code that will not look attractive. So pick a simple, short title for your content and live with that.  Lastly, note that usually you'll have to do HTML code to make links work properly in Blogger.

One more very important thing to note. This time look at the raw code from the feed, as seen in the messy Chrome version. You'll notice (though I've blocked it out for my privacy) that the link for that feed shows up several times, as does your Google username, and Google email address. This might be a privacy concern to you, so I would just suggest that you keep the address for this feed private. This really won't be a problem because IFTTT will be the only one knowing about your feed and will convert the feed into Blogger/Twitter code, discarding the original feed link and your username and email.


Viewing in Chrome, it looks like a mess, because it's just raw RSS code...

Now, login to your IFTTT.com account. Create a new recipe of a Feed updating your Blogger (or your Twitter, if you prefer).




For the feed address, use the link provided by Google Spreadsheet's Publish to Web and set the Trigger to "New Feed item."



Now you will setup your Action. The "Feed" option on IFTTT is rather limited as a Trigger, so I've had to improvise on what to use for my post contents. You'll notice that I've set "EntryTitle" to be the title of my Blogger post. This corresponds to the A2 cell on my spreadsheet, which is the title of the feed item as seen in the IE screenshot. For the Blogger post's Body I've used "EntryContent" which corresponds to cell B2 on my spreadsheet (or the mashup of B2 and C2 if you have contents in C2). This is the content part of the feed as seen in IE.



Viewing in Internet Explorer, it looks nice, since it is formatted properly as a RSS feed


The original Google Spreadsheet
Labels for Blogger is the tricky part. If you don't care about labels, then don't worry too much about it. I do care about labels, so I had to invent a way to also include the labels. It's not pretty, but it works. I used the "FeedTitle" piece to fill in the label. The FeedTitle is actually your spreadsheet's sheet name. This was the only other controllable part of the feed that I could utilize, so that's why I'm using it. As I said, it's not pretty, but it works. Additionally, this means that any time I want to want to change a new post's label, I have to rename my spreadsheet's sheet. This is annoying. But, again, what else could you do?  The other problem with this is that IFTTT only updates every 15 minutes. That means if you want to do two posts in a short time frame and need different labels for them, then you'll have to wait 15 minutes before you add the second post to your spreadsheet. This is annoying, but...

Test your IFTTT trigger (hit the manual refresh button for IFTTT if you need to). Then checkout your Blogger blog. It should now have a new post which is made up from your Google Spreadsheet.




Now any time you want to update your blog, just add a new line to your spreadsheet with your new post. Note: I have had some difficulty with it posting correctly if I delete the earlier rows in the spreadsheet, so it's probably easiest just to keep adding new rows with the new posts. If you do delete the old rows, you can manually refresh IFTTT and that seems to fix it to update properly from then on.  Your spreadsheet should update its RSS feed within a few minutes, and IFTTT will check for a new feed item every 15 minutes, and use that new post to create a new Blogger post.

You could also easily set up this method to post to Twitter. On IFTTT, just set up your Action to be Twitter instead of Blogger. In that case, you can ignore the labels altogether! Unless you want to use the spreadsheet name with an added hashtag to make Twitter tags.  In my case, I have IFTTT update Twitter from my Blogger feed using a separate recipe, so I have no need of this.

Take away: you can use Google spreadsheets to automatically update your Blogger or Twitter feeds. Or you could just update them the old fashioned way and ignore all this junk!

Hope you learned something. Enjoy!



Tuesday, June 4, 2013

Chrubuntu on Acer C7

This past weekend I worked on installing Chrubuntu on my new Acer C7 Chromebook (from Amazon, though I got the 4GB memory one for $250).

Happily, Jay Lee had just posted new instructions on how to install it with his new script the day before I endeavored to install it.  I followed his instructions, and overall it went quite well.  It was a painless process, although I had to follow the directions quite closely.  The pre-Chrubuntu install instructions for setting up Developer Mode on the chromebook I followed from here.

Using Lee's script, I set up 250GBs for the Chrubuntu partition, leaving about 50GBs (after formatting) for the ChromeOS, which I left on my machine.  I have not actually even ever booted into ChromeOS, as I purchased the Chromebook entirely for Chrubuntu.  The install process took about 45 minutes on a fast internet connection, and was mostly automated besides perhaps 4 or 5 times where I had to input my preference for keyboard style, language, etc.

Chrubuntu works well on my machine.  I installed it with the xubuntu desktop, since that seemed to use the least resources.  I may try to install KDE or Unity later to see how well it works.  This is my first major foray into the world of Linux, and I am pleased so far.

Initially there was an issue with the wifi not working, but Lee fixed that the next day with a simple fix that is now incorporated into his script.

The only other thing I am working on fixing now is the function keys and mapping them to the correct tools.  I am planning to use these instructions to fix it.

Xubuntu only comes with Abiword, so I may opt to install LibreOffice later. I have also installed Xiphos Bible software for it, as suits my needs.  It came with Chrome browser installed, so that is perfect.

Overall, I am very pleased with my purchase, and I really love Chrubuntu.  Many thanks to Jay Lee for his work on this project!  The Acer is a little bigger than the Samsung model would be, and it definitely was heavier when I first received it than I expected, but I have gotten used to it, and it is not too heavy now.  The screen is nicely sized, and the keyboard, although small, is manageable.  The battery life under Chrubuntu with xfce seems very good, some four hours or so, as advertised.