5

I have some data that I want to write to a simple multi-column table in Google Docs. Is this way too cumbersome to even begin attempting? I would just render it in XHTML, but my client has a very specific work flow set up on Google Docs that she doesn't want me to interfere with. The Google Docs API seems more geared toward updating metadata and making simple changes to the file format than it is toward undertaking the task of writing entire documents using only raw data and a few formatting rules. Am I missing something, or are there any other libraries that might be able to achieve this?

Claudio Cherubino
  • 14,896
  • 1
  • 35
  • 42
user1427661
  • 11,158
  • 28
  • 90
  • 132
  • I guess taking a read at this could help (don't know if there are better ways, but the HTML Request API would be my first try: https://developers.google.com/google-apps/spreadsheets/ – heltonbiker Jan 09 '13 at 23:19

1 Answers1

2

From the docs:

What can this API do?

The Google Documents List API allows developers to create, retrieve, update, and delete Google Docs (including but not limited to text documents, spreadsheets, presentations, and drawings), files, and collections.

So maybe you could save your data to an excel worksheet temporarily and then upload and convert this.

Saving to excel can be done with xlwt:

import xlwt
workbook = xlwt.Workbook()
sheet = workbook.add_sheet('Sheet 1')
sheet.write(0,1,'First text')
workbook.save('test.xls')
Thorsten Kranz
  • 12,492
  • 2
  • 39
  • 56
  • There is a dedicated spreadsheet api here: https://developers.google.com/google-apps/spreadsheets/ – heltonbiker Jan 09 '13 at 23:20
  • But this cannot be used for uploading or creating. They point developers to the documents-list API linked to in my answer – Thorsten Kranz Jan 09 '13 at 23:23
  • I could do a spreadsheet in the worst case scenario, but the data is more conducive to a table in a word document, and not one easily convertible from a spreadsheet format either. – user1427661 Jan 09 '13 at 23:38
  • 1
    Then just make a compatible word-like document and upload it, e.g., look [here](http://stackoverflow.com/questions/1035183/how-can-i-create-a-word-document-using-python) – Thorsten Kranz Jan 10 '13 at 01:34