I have a requirement to modify an existing .NET-based document generator, which today creates Word documents or HTML files. The App is moving into the cloud, and so have a full install of MS Office on every image is too complicated. So I'd like to generate GoogleDocs format documents instead, because now there's a great API which lets me do that. Except I can't find a way through the mass of options.
Plan A So far, I've managed to:
- Create a new (empty) document
- Re-open that document, and batch-up changes to it using the 'bachUpdate' API.
( the googledocs .net examples from https://developers.google.com/docs/api/quickstart/dotnet are helpful to get past all the authentication magic)
But my documents are usually 10s, sometimes 100s of pages long, so going back to the server, even with batches of updates, seems an unnecessary performance overhead.
Plan B For best performance, and to keep most of the existing generator code, I tried creating the whole document in the JSON style which Google requires, just as a .JSON file. I tried the example file from https://developers.google.com/docs/api/samples/output-json so I'm sure it's in a valid format.
So then I tried:
- changing the file type to gdoc then..
- copying it to a google drive - Google won't let me
- uploading it to GoogleDrive: Google didn't like that either
- I even tried uploading the HTML-format file from the exisitng generator, but it loses lots of the clever formatting which Word, and GoogleDocs, allow
So I need a way to upload a JSON file so that that Google understands its a GoogleDocs document.
How to download / upload the JSON representation of a Google doc? comes close, but doesn't quite show me the 'upload the JSON document' bit. The Google examples https://developers.google.com/docs/api/samples also only show small number of updates, not the single-file, large scale upload I need.
Am I missing something here? I seem to be so close to a working solution. Or is there a Plan C ?