How to articles, some life hack tips, basically your daily dose of brain food. Subscribe for Daily updates

May 18, 2009

GoogleLookup: do things you never thought possible with spreadsheets

For those of you not familiar with functions in Google Spreadsheets (the function-savvy may skip to paragraph 3), here’s a really simple example of a more conventional function: sum. In any spreadsheet cell, if I enter =SUM(3+5) and hit the “return” button, the content of the cell will display 8. Functions can also refer to values already in your spreadsheet, which is what makes them particularly useful. For instance, the function =SUM(A2:A20) will instantly sum all of the values in column A, rows 2 through 20. If you want to try this yourself, go to http://docs.google.com/ and open a new spreadsheet. You can also learn more about functions in the Google Docs Help Center.

So what makes GoogleLookup really cool is that it references data not just from your spreadsheet (as with functions like =SUM(A2:A20)), but searches that incredibly expansive body of published information: the world wide web. By performing a targeted websearch, GoogleLookup attempts to return some fact about the entity you specify. City populations are a nice example. Entering =GoogleLookup(”Philadelphia”; “population”) in any spreadsheet cell…

screenshot: GoogleLookup function

screenshot: GoogleLookup function

screenshot: GoogleLookUp loading

screenshot: GoogleLookUp loading

returns the value 1,449,634, which is in fact accurate. This may sound like magic, but go ahead and try it in a spreadsheet of your own. Now try swapping out “Philadelphia” for other city names: New York, Boston, San Francisco, Bangkok, London…

Radical, no? Perhaps you are saying to yourself, “this seemingly magical feature is indeed rad, but what real world scenario would actually warrant use of this function? How can GoogleLookup help me?” Let’s look at one example.

My good friend Caroline recently asked me and Dan to recommend some awesome dance songs for her upcoming wedding. Needless to say, Dan and I had lots of suggestions. Rather than rattle them off while she took notes on a scrap of paper, I told Caroline that I would send her a spreadsheet. When I got home, I opened a new spreadsheet and typed out 26 dancable song titles. But I wanted to give Caroline a little more information — I wanted to include the artist of each song. I didn’t know the artists for some of the songs on the list (especially for some of the more questionable tracks, all suggested by Dan) but I could have looked each one up and then typed out the artists name. This might have taken 20 minutes. Instead, I used GoogleLookup to automate that process.

Take a look at the spreadsheet. In cell B2 (under “artist”) I typed =GoogleLookup($A2, “artist”). (ignore the $ symbol; it just means that I want the function to use column A even if I copy the formula into another column). I then copied this function into all of the cells in column B (just drag the lower right-hand corner and drop). Within moments, all of those cells were populated with likely values for the attribute “artist” given the entity in column A, the song title.

Now, as you will observe, the values are not perfect. Gloria Trevi is NOT the artist I had in mind when I suggested the classic rock tune, “Gloria.” And while UB40 did do a version of “Can’t Help Falling in Love With You,” I would urge Caroline to stick with the Elvis original. But there were also a lot of accurate values. And one cool subfeature of GoogleLookup is that clicking into the cell will trigger a pop-up citing the source (url) of the value and offering a “more options…” link.

screenshot: click into cell for more info

screenshot: click into cell for more info

Clicking “More options…” will give you up to three alternative values (and the sources from which these values come).

screenshot: more options for GoogleLookup

screenshot: more options for GoogleLookup

You can easily change the displayed value by selecting one of these alternatives.

As you can see on my Good Dance Songs spreadsheet, I used GoogleLookup to populate two more columns: album and year, both of which will be helpful to Caroline and her DJ (the functions, respectively: =GoogleLookup($A2, “album”), =GoogleLookup($A2, “year”)).

So next time your boss hands you a list of US states and asks you to fill in the capital of each state by EOD; or a list of years for which she would like the Academy Award winner for “Best Film”; or a 200 row list of NBA players, each of which needs a “height”… don’t fret, use GoogleLookup to quickly get the data you need.