Skip to main content

Ralsina.Me — Roberto Alsina's website

Open with: Google Docs

The eee is smal­l. It has very lit­tle stor­age. So, why should I use dozens of MB on a word pro­ces­sor? Be­cause I get word doc­u­ments in the mail ev­ery once in a while.

In fac­t, the on­ly word doc­u­ments I get are er­ror mes­sages from win­dows user­s. Here's the pro­ce­dure ev­ery one of them seems to have found to tell me what's in­side ex­plor­er's er­ror pages:

  1. Cap­­ture the screen

  2. Paste it in­­­to Word

  3. Mail it to me

I sup­pose copy­&­paste of the page con­tents was too hard. But any­way, I usu­al­ly man­age by hav­ing kword or abi­word handy, but I was think­ing...

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('joe@gmail.com', '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 fire­fox, a de­cent ver­sion of python and gda­ta it should open the doc you pass as first ar­gu­ment on google docs in fire­fox.

Re­mem­ber that you need to delete it lat­er if you don't want it, and re­name it if you want to keep it with a de­cent name.

I am not turn­ing it in­to a re­al ap­p, but it's good enough for me. Put it in your path and as­so­ciate it to your .doc files.

A sim­i­lar thing for .xls is triv­ial. A script that would han­dle both, al­so.

Could please some­one take this and make it a re­al ap­p?


Contents © 2000-2024 Roberto Alsina