So you've got a spreadsheet of useful stuff that you want to be able to easily update and turn into an online searchable resource, but you don't want to have to set up a database. Well, Google have the tools for that. Google provide a lot of info, but I found this overwhelming when I got started so am hoping this offers a simple way to get you going.
You'll need a Google account and a place you can edit php webpages (or something like a blog/Blackboard you can enter code).
We're going to create a Google Spreadsheet and then set up a webpage with some special 'visualisation' html to make it searchable, sortable and openly available online! Here's how...
First, set up a new Google Spreadsheet from your Google Docs account.
Fill the spreadsheet with your resources, list or whatever. You'll note I've left the top row blank - I've had problems getting Google to recognise my column headers so tend to leave it blank and we'll label it up later.
Once you've got some data we need to 'publish' the sheet so we can talk to it from our web page.
On the publish screen, click the 'start publishing' button which will make a long web address appear, you need to copy this into notepad or somewhere handy as we'll need the 'key' from this shortly (the bit from after "key=" up until "&output-html").
You also need to change the 'Sharing Settings' to Public, otherwise users need to be logged into Google to make this work - you could use sharing settings to only allow individuals, but in this case, just make it public.
Here is the magic, you need to copy this code into your favourite webpage editor. The code is here. To complete this demo and build a page that searches columns A and B and displays all three then the only edit you need to do is to swap the key from my version to the one you made a note of in the step above. Paste it in, save it and upload it to your web server.
If you're feeling imaginative, this is the line that does the magic you might want to explore:
'SELECT A, B, C where upper(A) like upper("%%") or upper(B) like upper("%%") order by A asc label A "Type", B "Title", C "Date added"'
What this does is says:
Show me columns A, B and C...
...where the thing you searched for matches (in upper case to make sure case doesn't matter) anything in column A or column B...
...order the results by column A is ascending alphabetical order...
...and label the columns like this.
You can find out many more options of what you can do with this query on the Google pages.
The one I made now looks like this (see it for real here).
A couple of real-life examples of this.
2. Virtual Research Unit Funding Opportunities (University of Brighton). This uses some extra category fields on the spreadsheet and then a new query is built depending on what the user clicked on allowing filtering as well as searching.
For those of you without 'proper' access to webpages, you'll be please to hear you can embed this in something like Blackboard. The search box bit doesn't work but you can display the spreadsheet and let the user view it and sort it.
In Blackboard you'll need to enter a simple version of the code (simple version available here - like above but without the search box stuff) into an item when the visual editor is turned off.
This is what it looks like in Blackboard.
Good luck - and if this works for you, please let me know in the comments, would love to see what you do with it!









20 comments:
I had a go with the 'simple code', into a Bb item, using MacBook Pro and Firefox, but got 'Access Denied'.
Was logged into to Google Docs but perhaps the code has to be shared?
Sorry Joyce - I forgot a step to make the spreadsheet public, which I've now done, so check now and it should work for you...my fault for not testing when logged out of Google!
Great post, but I'm having trouble once I finish the code. When I hit preview (in the Blogger code software - might be part of the problem), this is what I see:
$search= $_REQUEST['search'];
if ($search > ''){ $search = $search;} else { $search = '';}
?>
I don't see the spreadsheet itself, but I see the search box and I can type and search, but then when I hit submit query I get a message that says "Method Not Allowed Error 405".
Any idea what's going on?
Hi Emily - I expect Blogger is rejecting the code as it isn't a true web page editor. Try pasting in my 'simple code' instead:
http://nowlookhear.co.uk/katiepiatt/codesimple.html
Which is just the spreadsheet and not the searchbox. Just tried and think it works ok!
That worked great! So now that I have the spreadsheet showing up, what can I do to get the search box to show up? Should I retry the longer code?
Great - only you'll be out of luck with the search box embedding it in a blog I think, because I use some php code to sort out the search value, and that won't work unless it's run properly - ie an html page on a web server that supports php. It's the simple version only if you're embedding in a blog or Blackboard etc.
I'm sure there's someone out there who can figure out a way, and I hope they reply, whoever they are!
Ah ok that makes sense - thanks so much for your help!
This is a GREAT tutorial. The best I have come across trolling for help.
I tried Blogger no luck. Any idea a site that would work? Do I have to have access to a server?
Thansk
@Jane_says glad you found it useful. The simple code works in blogger, it's just if you want the search box as well you need a 'proper' server.
This is great! Using to keep track of coupons in my coupon binder and where they are located. Super easy and awesome. Thanks!
Hi. I have been having trouble getting this to work by embedding it into a weebly page or a wikispaces page and as I saw in a previous post, those may not support embedded php which makes sense. But then I just created a simple html page and uploaded that to my own server (which does have php installed) and I got the same errors. I even tried using your code exactly as it is and just copied it into an html document and uploaded that to my site. I still get the same error that looks like this:
''){ $search = $search;} else { $search = '';} ?>
Any help would be appreciated. I am quite eager to get this to work. I am building a searchable database of student websites for a school (a stopgap measure until we get a LMS set up properly later in the year.)
@teacherben
The line: if ($search > ''){ $search = $search;} else { $search = '';}
should if with all single quotes, so an opening and closing single quote, am guessing you used double quote?
Hi! Great tutorial, I'm going to try something like this out for a database for my theatre department's video collection. I have a question though, would this work with a spreadsheet with multiple sheets?
Hi danarchy - to be honest I've never tried with multiple sheets, I'm not sure how you would change the query to look at a particular sheet. When you publish it, you can choose one sheet or all sheets, so you could certainly have multiple sheets, but I'm sure having all the data for your application on one sheet would be easier to query.
Katie
Don't forget to ensure you save your file with a .php reference nothing else else you'll never get it working.
Great tutorial Katie.
Great post. Here’s a product with a powerful database in the cloud with ready-made apps. Just point-and-click to build your custom apps http://www.caspio.com/
Great post. Here’s how you can convert Microsoft Access to web in minutes http://www.caspio.com/extend/platform-extensions/ms-access-database-online/convert-ms-access-to-web.aspx
Works perfectly thank you. Is it possible to add in hyperlinks? I've tried inserting them in the spreadsheet but the link disappears in the search.
Also, Is it possible to then create an offline copy? I can't see that it would but I have a demanding boss!
Hi Katie,
This is a great post! I am trying to develop a searchable database but ran into the same problem as Emily above, as I use blogger.
Is it feasible that the google doc can be queried without using php?
Thanks and best regards,
SER
Post a Comment