I read this post on the Google Blog today and my first thought was “Wow, cool”, my second thought was “I wonder if you could create a poll with that?”. It turns out that there are a whole bunch of problems displaying the results. Here is a quick proof of concept...
Note: for any readers subscribed to the blog via RSS, you need to view originating page, due to embedded IFRAMEs.
Go ahead, try it. Choose an option, you know you want to!
And here are the results so far
Pretty cool eh?
Unfortunately, your results will not immediately update the chart because it’s just published as an image. However, there is a load of potential there.
So, How Is It Done?
Well, the first thing you need is a google account, then go to Google Spreadsheets and create a new document. Make the first few rows be the same as the number of options in your poll.
The next thing we need is to provide formulae for column B. We need to count the number of occurrences of each option text that occurs below our options. The formula for this is
=COUNTIF(C2:C100000, “I like it a lot”) (the option text in this case is “I like it a lot”, change it to match your option).
Repeat this formula for each option and then create a graph of the results.
The next thing to do is to share the sheet as form. Click the share tab and choose the “Invite people to fill out a form” option. You’ll be asked to fill out a quite complex window, but fill in the question and choose either multiple choice or choose from a list. You’re smart, you’ll figure out the rest.
Finally, send the form to your own email address. It will let you test it out and add some data to your spreadsheet.
How Do I Embed It In My Blog?
There are two stages, first embed the poll, second embed the results.
Go back to your spreadsheet and click “Go to live form”. It will open a new window with the form, so you can copy the URL from your browser’s address bar.
Next add an IFRAME to the page that you want the poll to appear in. Try the following text:
<iframe src="YOUR LIVE URL"> <p>Please wait...<p> <iframe>
Next, we want to embed the results. If you’re doing this as a chart, it’s just an image. To get the URL of the image, click on the chart in your spreadsheet and then click the menu at the top left of the chart. Choose the “Publish chart...” option. A window will pop up with the HTML you need. Put that in your page too.
Finally, we must ensure that the chart is updated regularly, for this you need to publish the entire spreadsheet, so click the “Publish” tab and choose the option to automatically republish after changes.
Unfortunately, the chart won’t be updated after each time you add a poll entry because the picture is stored in your browser’s cache, but there is not much we can do about that.
It is early days for this new feature and it’s already quite exciting but I would like to see a few new things as a result of this experiment:
- A better confirmation message - especially one that could show the chart
- Improved chart updates - the spreadsheets themselves are really good for collaborative working and the charts could do with some of the same
- More control over the chart rendering - you can see above that the legend in painfully small
Overall, it’s a very cool feature and I’m sure that forms providers like Wufoo are taking note and raising their game.