Thursday, February 05, 2009

Twitter Meets Excel and Google Docs

I've mentioned before how addictively easy to use the Twitter API is. Once you learn about it, you can't help but start embedding it everywhere.

With that said, I still think it's pretty cool that someone whipped up some Excel code to allow you to Twitter from inside a spreadsheet. Thanks go to my Dad for the link.

I couldn't help taking a few minutes and thinking how the Twitter API might mesh with Google Spreadsheets. Turns out, you can trivially make use of Google Spreadsheet's importXML function and Twitter's Search API to end up with a Live Search Feed embedded in your document.

Here's an example:

The magic involves putting the following two formulas in cells B4 and C4 respectively:

=importFeed("" &SUBSTITUTE($B$2," ", "+"), "items summary", true)

=importFeed("" &SUBSTITUTE($B$2," ", "+"), "items url", true)

Both of these cells refer to $B$2, which contains the search term to use.

Writing this was easy. Coming up with an actual case of where you'd use this, is trickier. Twitter provides a stream of what people are chatting about, so this allows you to embed real time conversations into your document. Again, why would you do this? Not sure...but you can.


  1. finally a useful purpose for excel... just kidding, Excel is probably one of the every few Microsoft applications I like... that said, I've basically moved everything to OpenOffice

  2. Do you know why this won't keep populating the spreadsheet but instead just refreshes only the latest 20 posts in the feed?

    Is there an easy way you know of for getting around this to continually import a feed?


  3. James -

    You're looking for a way to capture the data and append the results, not keep a live view. Right?

    I'm not sure I have an's a relatively easy program to write, but I don't think you can do it just in high level Google Spreadsheet functions.