Analyzing Twitter with Excel, Part 4

24.04.2009

As I pointed out in the first column, to get all of the Tweets in the public timeline you'll need to make arrangements with the folks at Twitter. On the other hand, if the topic you're interested in is generating 15 or less Tweets in a given period (call that X minutes) you could just repeatedly access the RSS feed every X minutes to get a quasi real-time snapshot.

Here's how to do that: In Excel set up an XML Map by selecting Data > XML > XML Source and then click on XML Maps. In the XML Maps dialog that appears click on Add then in the filename field enter http://search.twitter.com/search.rss?q=PRODUCTNAME (fill in what you're tracking there at the end) and then click on Open. You'll go back to the XML Maps dialog so now click on OK. Excel will then display the schema of the feed.

Drag the item pubDate from the XML tree onto your spreadsheet, say, onto cell A3. Now right click on A3 and select XML > Refresh XML data and the cells below A3 will contain the publication times of the last 15 Tweets.

To get an analysis of this data you'll need to massage the pubDate values to extract dates and times, then use a pivot table to correlate the derived values and a pivot chart to plot them. Sounds complicated? It is.

I leave as an exercise for the more intrepid reader to make the spreadsheet periodically refresh and update the graph. On the other hand, I have also wrapped the spreadsheet with an XML Map in an Xcelsius presentation so it automatically refreshes and redraws the graph.