Using Excel as a web CMS

<![CDATA[quizzical-demo2I was recently tasked with developing a CMS for quizzes and personality tests. On the face of it the requirement was pretty straightforward: a bunch of web forms that would allow users to create and host their own online quizzes and tests.

I’d already completed the ‘front end’ part of the task with my JSFiddle-based quiz system, so the CMS part looked straightforward.

However, the more I thought about it the more it grew arms and legs: users can have any number of quizzes, quizzes can have any number of questions, questions can have any number of answers and each of those answers can have an associated score. Scores add up to create an outcome and there can be any number of outcomes per quiz. Quizzes, questions, answers and outcomes can also have associated images.

So far so good, but then there’s the question of saving quizzes, duplicating them, sharing them with trusted others, etc. And all of that requires user accounts with the permissions management overhead that implies.

I thought there must be a better way… at least for simple requirements like this.

My solution was to use MS Excel as the CMS which, ridiculous as it may sound, instantly brought some benefits:

  • No web forms to build, and no complex database requirements.
  • Users can store, duplicate and share their quiz “recipes” with colleagues without needing me to build that functionality.
  • Because nothing is stored online there are no logins required, so less setup, and less management required.


Creating a parser to turn Excel files into a Javascript web app is surprisingly easy:

  1. I’m using Dropzone to allow drag-and-drop uploads from the browser.
  2. Uploaded files are handled by a PHP script which uses Simplexlsx to convert Excel files into regular PHP arrays.
  3. Excel files are converted on-the-fly and returned into the page as a live demo for the user to test. (A tip I learned here is PHP’s json_encode is a great way to turn just about any PHP data structure — from simple strings to associative arrays — into it’s Javascript-safe equivalent.)
  4. PHP output buffering is used to save that preview as a file, so if the user likes what they see, they’re one click away from grabbing the output as a live URL.

The whole system, from the setup of the Excel template to the PHP parser took around 2-3 hours to build. That’s far less than it would’ve taken me to create the equivalent database and set of web forms, not even considering the extra time it would take to create sharing functionality and user account controls.

This clearly isn’t a solution for every project, but it’s worth keeping in mind as a quick solution to an otherwise time-consuming programming job.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.