Thursday, August 11, 2016

Asked and Answered: Displaying A Random Answer From A Google Spreadsheet Based Survey

Apparently Cool Tools ran a reader's survey and the results are now posted. I've picked up many solid tools based on the site's recommendations and the site's signal to noise ratio is something they should be proud of. I appreciate that there's a fundamental challenge to the site: conventional wisdom says to succeed you need to publish frequently, but for the site to maintain its value and credibility it needs to publish less so. I'm sure striking that balance is non-trivial, especially with the need to continually grow the site.

If I'd actually seen the survey and had the chance to chime in with recommendations, I'd have made these two:

(1) Stay small and stick what the core site does well. I don't need another gear blog telling me I need the latest gadget. I just need to know about rock solid tools that have proven themselves. Less is more.

(2) The latest site redesign is absolutely horrendous. I mean, visually, it's painful. I'm not sure if you were going for a retro look or not, but yeah, no. If you want old school by all means go the Craigslist route. What you ended up with was like something I'd concoct, so I know you're on the wrong track. The Turkish Proverb applies here; time for another redesign.

OK, back on topic.

The folks at Cool Tools were kind enough to publish the underlying data behind their survey (they did so here). Looking it over, I got a kick out of the second question, which poses:

If you were marooned on a desert island after a plane crash, what is the one tool you’d take that could pass TSA screening?

Now that's my kind of question. I was curious to see what the 1,400 or so responses were. I suppose I could have just read through them, but that would be too easy. I decided to use this as a little programming exercise.

The idea: create a quick little website that pulls and displays a random answer based on the data of a Google Spreadsheet. While I was writing the code to get at a specific answer on a specific Google Sheet, the solution should be easily adjusted to any Google Doc data source.

And here's my solution: Asked And Answered, it's about 75 lines of PHP. The code is built using this strategy to access the data in the Google Spreadsheet. It even includes caching to provide for relatively quick page loading.

Here's the script in action:

So sit back and enjoy a little peek into the mindset of Cool Tool readers. And feel free to grab the code and customize it for your own project.

No comments:

Post a Comment