Using Google Spreadsheet forms with Flash
Saturday, August 2nd, 2008 | Actionscript 2, Actionscript 3
Overview
Google Spreadsheet forms are an ideal way to collect information from users, like messages, comments or feedback. You don’t need to do any work on your part to store it, no databases, files or anything like that. It relies only on the fact that you have a google account, and can put together a very simple spreadsheet form.
As a very simple example, if you were making a flash site for a client and wanted to put in a contact form that users could add messages to a stored list, then this would be an ideal way to provide a solution that you wouldn’t have to maintain, and that your client would have instant access to in an easy format. They can even output it to excel.
Format
All you need to do is pass in your LoadVars or URLVariables in post format variables like this:
sender["entry.0.single"] = “my string to add to spreadsheet”;
Where the number between entry and single is an incrementing number denoting the control in the form to mirror. So in this example the entry.0.single represents the name text field control in the google spreadsheet form.
Crossdomain and php proxy
Unfortunately the google spreadsheets crosssdomain.xml does not allow flash content to access the spreadsheets url but by using a fairly simple php proxy we can easily get round this.
So the LoadVars/URLLoader calls the local GoogleSpreadsheetProxy.php passing all the vars and the url for submitting the spreadsheet and simply proxys the request via the url passed.
Spreadsheet document the example feeds into:
http://spreadsheets.google.com/ccc?key=pyxyLmVwUP3PhX7wp6GV_SQ&hl=en
Example:
Source Code Flavours:
7 Comments to Using Google Spreadsheet forms with Flash
Thanks for this. I’m considering using this for the comments/message board system of a flash based blog. I have a couple of questions though:
How secure is this method? Is it best to try and implement spam filtering on the flash side or from the php/server side?
I’m quite familiar with AS3 but have less than a basic understanding of php. Is there a sample code for retrieving data from the google spread sheet to be sent back to flash?
January 28, 2009
It’s really a one sided way of storing data. There are ways of retrieving the data from a google spreadsheet. You’d have to “screen scrape”, here’s an example: http://matthewsteele.wordpress.com/2007/11/03/screen-scraping-google-spreadsheets-exported-as-html/
To be honest it sounds like you’d be better off just using an off the shelf comments/message board system plugged into a database and save your time for doing something more interesting, rather than reinventing the wheel.
February 3, 2009
[...] so I wouldn’t recommend deploying it on a public server. I got my script from a post on Aden Forshaw’s blog. In the real world you would want to have some security token to limit access to your proxy [...]
February 16, 2009
Very interesting, but doesnt work in this moment?!?
do you see Sprout can import a Google Form?
how does it work??
February 17, 2009
I’d try the latest example i’ve made http://www.adenforshaw.co.uk/?p=196
Sprout looks quite funky, it looks like they’ve done the sort of thing i’ve done here with the google forms.
I’m doing something kind of similar to sprout which is partly why i’m doing all these proof of concept examples and giving them away for free.
Love this post! Thanks for this. I
March 20, 2010
Is this working? I’ve been trying to do this, but I can’t. Thanks for your help
Leave a comment
Search
Recent Posts
Categories
@AdenForshaw
- On the train back from london, sat next to a portly chap wearing double denim rocking a pungent aroma of Eu de sweaty man. #BadTimes
- Crazy busy with people wanting to see the #Coull Affiliator in action, and some great ideas from people on how they want to use it in anger
- Presenting new @Coull Affiliator in #Cocoon lounge bar Picadilly. Only snag is it's soft drinks only... torture!
- #JazzBarMonday is always a winner, some New Orleans classics coming out to play, there's pride on bourbon street http://twitpic.com/1mrzhl
- The old boys rockin it hard over at the #OldDuke http://twitpic.com/1mrsn2
January 21, 2009