Posts tagged Google Docs
Linking to a Cell in a Google Spreadsheet
1Because I can’t stop playing with something that already works fine, I’ve continued to tweak my syllabus-generating spreadsheet. With the addition of an external script, I’m able to link directly to a specific cell in the spreadsheet — letting me share a link to my syllabi that takes people not just to the overall document, but to the current day (or the next day that’s closest to the current day) in the syllabus. The script could be used to link to any cell in any published Google Spreadsheet, with the caveat that if there are multiple cells with that match that value, the link will take you to the first appearance of the value in the spreadsheet.
$url = $_REQUEST["url"]; $key = $_REQUEST["key"]; $anchor = $_REQUEST["anchor"]; $html = file_get_contents($url); $output = str_replace($key, "<a name="$anchor"></a>$key", $html); $output = str_replace("href='/", "href='https://docs.google.com/", $output); header("Content-Type: text/html"); echo $output; |
This takes a GET URL of the format http://server/script?url=[url]&key=[key]&anchor=[anchor]#[anchor], where…
- The URL is the URL of the published Google spreadsheet location.
- The key is the text to search for in the spreadsheet (so you could link to anything in the published HTML, but it’s easiest to link to a unique value in a cell).
- The anchor is the name of the HREF anchor you will be creating (note that you then need to, well… link to that anchor).
Nota Bene: You have to add your own link to the anchor — this is a quick, slapped-together connection to my script.
Update: I was sitting here staring at the script, trying to figure out why I hadn’t put the anchor tag around the key, and then I realized what’s going on. The key (on my spreadsheet) is formatted to be white text on a white background (Rothko-style, if you will). If it gets converted to an anchor, its styling is affected and (without more work in the script) it turns blue and underlined. Lame. So… the anchor goes before the key, so the key’s CSS style won’t be affected.
This is why you document your code. Even when it’s short.
Building a Google Earth Tour in a Spreadsheet
1For the last couple of months, one of my high school classes at Jewish Day School has been working on building an interactive tool about the Six Day War for a middle school curriculum unit. They have put a lot of work into researching their data and laying it out in Google Earth, and now we’re putting together a tour of the data for the middle school students, that will also teach them a little about how to use Google Earth. It’s been enormously fun.
But. But, we now have to do some programming or some very careful recording in Google Earth to create this tour (a là Al Gore’s Climate Change tours). And my students are far more interested in the design end of things than in the coding end of things. They’re great at what they do, but niggling coding details give them head aches.
So I built a Google Docs spreadsheet, into which they can plug various pertinent information and out of which comes valid KML instructions that will define the tour. I’m a little proud of this — I don’t think that there’s anything else quite like it out there. There are three kinds of information that need to be entered:
- SoundCue — any audio that should be played in the background. You can either enter the whole URL to the MP3 file that should be played, or just the file name (and make sure that you enter the path in which all the files can be found on the KML Generator tab). You also need to tell us both when the cue should be played and how long it should last.
- AnimatedUpdate — anything that should be happening in Google Earth in terms of showing photo overlays or placemarks or polygons or what-have-you. Enter what should happen, and when (and, if relevant, for how long).
- FlyTo — any time we change where (or when) we’re looking at Google Earth. Enter when and how long the transition should take, and the date (and time) that we’re meant to be looking at.
The AnimatedUpdate and the FlyTo also expect the user to enter KML code — which can be copy-and-pasted from Google Earth KML exports for each transition. Happily, if something needs to happen more than once, entering the KML for the first instance will automatically populate future instances. In addition, the pauses necessary to synch up all of the action are calculated by the spreadsheet.
Update March 25, 2011: The spreadsheet above is our live work (since I kept updating the spreadsheet after this post).
The end result is both a visual timeline of the tour (helpful for debugging any weird errors) and also KML code that can be copy-and-pasted out of Google Docs and into a KML file. (Caveat emptor: depending on what you’re pasting the KML into — I like Xmplify — you may see that there is a leading and trailing quote that need to be manually deleted.)
Right now the spreadsheet can handle tours up to four minutes and 10 seconds in length (250 seconds, for those of you keeping score at home). This is because I was originally copying the KML out of the KML Orderer worksheet, and Google Docs supports pasting of up to 1000 rows in total. You’ll see that the current KML worksheet is a single cell, getting around this limitation, but I didn’t bother to extend any of the other worksheets. Just make sure you fill down all the formulas if you extend any of the sheets!
Here’s a link to a scratch copy of the spreadsheet. Feel free to copy and use it for your own purposes — let me know how you used it!
10 Things Better than Email Attachments
1One of my responsibilities at Jewish Day School is to write a weekly “tech tips” column for the online faculty news. This is one such tip (and it is, again, a bit FirstClass-centric, focused on some of our internal systems — we’re running a WPMU blog server and a MindTouch DekiWiki).
We won’t rehearse all of the problems with email attachments here (Can I open that file? What happened to my disk quota!? Which version was it?) Instead, let us focus on things that improve the experience. In fact, here’s a short video Top Ten list:
Links from the video
- Convenience: YouSendIt.com (and Scrivener, a fun writing application)
- Collaboration: Wikis (specifically the Laptop Leaders)
- Focus: Blogs (specifically the Digital Portfolios PLN — Seth, [and his colleagues] can help you set up your own)
- Reach Out: Google Docs (and Spreadsheets, Presentations, and more…)
- Brevity: The History Of The Decline And Fall Of The Roman Empire by Edward Gibbon