views:

57

answers:

1

Hi

I am running django on python sdk of gae.

My application is an order processing app for a small business. I want to email a delivery note in the form of a spreadsheet to customers on completion of an order. Now I have been reading the docs and its no problem sending attachments, just that only certain file types are allowed in gae.

I have created a spreadsheet document using the google data api, but my problem is how to get the google spreadsheet document emailed to the customer. My appengine is on a hosted domain, so normal gmail accounts don't have access to it and many of the customer email accounts won't even be gmail anyway, the google spreadsheet attachment will just be a xml atom object pointing to a doc hosted on my account which won't be accessible to outside users anyhow, right?

Is there any way to copy this spreadsheet object and attach it to the email, so it can be opened locally by users with no access rights to my google doc, it can basically be opened offline. My code looks like this:

    new_entry = gdata.GDataEntry()
    new_entry.title = gdata.atom.Title(text='Delivery Note from ' + company.company_name)
    category = gd_client._MakeKindCategory(gdata.docs.service.SPREADSHEET_LABEL)
    new_entry.category.append(category)
    doc_entry = gd_client.Post(new_entry, '/feeds/documents/private/full')
   .....now build the spreadsheet
   doc_title = 'deliverynote' + '.' +  doc_entry.title.type
   .....build the email body
   mail.send_mail(sender_address, to_address, subject, body, attachments=[(doc_title, str(doc_entry))])

Doing it this way however when the customer receives the mail, when they try and open it they get an unexpected error (the exact words that google uses when it tries and opens it).

The other alternative of course is to try and convert it to an excel file. Methods are provided by google to export the file as an excel file to the local file system, but then the program is faced with the problem of uploading it again without any manual user intervention. Besides the excel file type isn't supported by gae as a legitimate attachment type.

Has anyone got any ideas?

A: 

Interesting question.

Since you use GData to create it, your GAE app should have rights to get a copy of it and attach it. Not sure what format it would be in, and how the guy that receives it uses it though.

If you attached a Google spreadsheet to an email, how would the person open it? Since Google runs "on the web"? I know Google now has an offline option, but I haven't tried it yet. I think it requires install Google Gears and other stuff on the local machine.

Do you want people to share the spreadsheet or each get their own copy? Could you just change the rights to let more people have read-only or update access?

Do all your recipients have Excel? Do they all have Google App Accounts?

Neal Walters

NealWalters