2008-02-12 12:15

Open with: Google Docs

The eee is small. It has very little storage. So, why should I use dozens of MB on a word processor? Because I get word documents in the mail every once in a while.

In fact, the only word documents I get are error messages from windows users. Here's the procedure every one of them seems to have found to tell me what's inside explorer's error pages:

  1. Capture the screen
  2. Paste it into Word
  3. Mail it to me

I suppose copy&paste of the page contents was too hard. But anyway, I usually manage by having kword or abiword handy, but I was thinking...

I am reading my email. That means I am on the net. That means google docs is right there. And they have a python API! 15 minutes later... open_with_gdocs.py

#!/usr/bin/env python
import gdata.docs.service,gdata,sys,os

# Create a client class which will make HTTP requests with Google Docs server.
client = gdata.docs.service.DocsService()
# Authenticate using your Google Docs email address and password.
client.ClientLogin('[email protected]', 'whateveritis')

ms = gdata.MediaSource(file_path = sys.argv[1], content_type = "application/msword")
entry = client.UploadDocument(ms,"tmp_open_with_gdocs/%s"%sys.argv[1])
os.system("firefox '%s'"%entry.GetAlternateLink().href)

Try it, as long as you have firefox, a decent version of python and gdata it should open the doc you pass as first argument on google docs in firefox.

Remember that you need to delete it later if you don't want it, and rename it if you want to keep it with a decent name.

I am not turning it into a real app, but it's good enough for me. Put it in your path and associate it to your .doc files.

A similar thing for .xls is trivial. A script that would handle both, also.

Could please someone take this and make it a real app?


Comments powered by Disqus

Contents © 2000-2019 Roberto Alsina