CWYAlpha

Just another WordPress.com site

Thought this was cool: Twitter Client for Excel with Python and DataNitro – Victor Jakubiuk’s blog

leave a comment »


Comments: “Twitter Client for Excel with Python and DataNitro – Victor Jakubiuk’s blog”

URL: http://mit.edu/~victorj/www/blog/2012/08/06/Twitter-reader-in-Excel-with-Python-and-DataNitro/

In this blog post I am going to show how I built NitroBird – a Twitter client for Excel – using Python, tweepy and DataNitro. NitroBird updates Excel worksheets with tweets as they are posted, lets you tweet from a worksheet as well as search and browse other user’s profile. See the code on Github or download a zip file with everything ready to run (Excel Worksheet, Python script and tweepy library).

Not everyone has the pleasure (?!) to spend all day at work on Twitter, and if you happen to occasionally work in Excel, I’m sure this worksheet will help you avoid suspicious looks from your colleagues or boss🙂 If that’s not the case, then at least this example will demonstrate how easy it is to connect Excel with external data sources using Python and DataNitro.

There are multiple Twitter Python libraries. I’ve used tweepy, which is extensively documented here. First, we have to deal with Twitter OAuth:

  • Set up your app keys. Go to developer.twitter.com, create a new app (with read and write privileges) and obtain your consumer key and consumer secret.
  • Open twitter.xlsx in MS Office 2007/2010, go to the settings sheet and input your new keys in cells B12 and B13 (by the time you read this, the keys provided by default will have probably been invalidated or will have exceeded Twitter rate limits).
  • Import nitrobird.py on the DataNitro tab.
  • Click ‘Run’.
  • Click the auto generated link and authorize the app to read & write.
  • Copy & paste the authentication code into cell B5

After these steps you should be ready to go and your settings worksheet will look like this:

You can now go the “profile” sheet to see your Twitter profile, your followers, friends and past tweets. After clicking the yellow “tweet” cell, NitroBird will post the content of cell D5 to your Twitter timeline:

An uninitiated eye looking at your “work” spreadsheet won’t be able to tell that you’re browsing Twitter, as your entire timeline is just a spreadsheet with tweets (updated every 2 minutes, or you can click ‘refresh’ to force it manually):

Lastly, you can search for specific tweets on the “search” sheet and browse other user’s profile on the “user” sheet. Feel free to tweak the code to your needs and enjoy your Twitter in Excel!


from Hacker News 50: http://mit.edu/~victorj/www/blog/2012/08/06/Twitter-reader-in-Excel-with-Python-and-DataNitro/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+hacker-news-feed-50+%28Hacker+News+50%29

Written by cwyalpha

八月 9, 2012 在 5:09 下午

发表在 Uncategorized

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: