So the docs say that you cannot create a blank sheet in google docs, that you must upload a sheet to create a new one...not true...On the front of the api page there was a link to a topic in the api discussion group,
create a new spreadsheets on Google Docs . The last entry from Eric gave me the clue or actually the answer. The "helper methods" took a few minutes of debugging to figure out.
In gdata.docs.service, the upload methods for spreadsheet, docs, etc. all call Post like this:
media_entry = self.Post(media_entry, '/feeds/documents/private/full',
media_source = media_source,
extra_headers = {'Slug' : media_source.file_name })
Here's the code. The example is in single user mode. When I put it on the requirements page, I'll change it.
def createBlankSpreadsheet(self):
client = gdata.docs.service.DocsService()
gdata.alt.appengine.run_on_appengine(client, store_tokens=False, single_user_mode=True)
client.email = 'youremailhere@gmail.com'
client.password = 'putpasswordhere'
client.source = 'exampleCo-exampleApp-1'
client.ProgrammaticLogin()
category = atom.Category(scheme=DATA_KIND_SCHEME,term=SPREADSHEET_KIND_TERM)
title="HeyMan2"
media_entry = gdata.GDataEntry()
media_entry.title = atom.Title(text=title)
media_entry.category.append(category)
media_entry = client.Post(media_entry, '/feeds/documents/private/full');
return media_entry.GetAlternateLink().href
Now this isn't perfect. While the spreadsheet is showing up in google docs, the request is timing out. The app engine has a 5 second timeout on http requests and that doesn't seem nearly long enough for the docs services to do its thing and return a response. I haven't received one response yet. I'll try the test out again tomorrow when I update the site on google.
This goof-up has made it all over the internets. For about an hour this morning google reported all results as distributors of malware. (big QA problem) I kind of freaked out when I began searching for stuff and found that wikipedia was going to "harm my computer". I went straight to Techcrunch and found this story.
Update - From google.
