There doesn't seem to be (to my knowledge) an API to edit Google Docs (not spreadsheets, their HTML based documents). Has anyone done something like the? Maybe by downloading the HTML version, editing and uploading the changes?
相关问题
- How can I force all files in a folder to be owned
- Google Apps Script: testing doPost() with cURL
- Google Apps Script to turn in, grade, and return a
- Invalidate Google Cloud CDN cache from the backend
- Getting 'Missing required field: member' w
相关文章
- How to embed Google Speech to Text API in Python p
- Does google-hosted jquery helps google to track vi
- Is there a google API to read cached content? [clo
- Creating GoogleApiClient for multiple activities
- Google Calendar - Permission to Access
- How to allow access for importrange function via a
- Google app script trigger not working
- Set Date/Time to 00:00:00
There is com.google.api.services.drive.model.File.getExportLinks
You can get a Google Doc as a docx (for example), edit it using your favourite docx editor, then upload again. See the samples for doing this (starting with GoogleDriveDownloadAsDocx) in the context of docx4j. Note the README.
Or do the same with any of the other export formats.
Not really sure if this is what you're looking for exactly but have you taken a look here http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html It looks like it allows editing for content (v3.0 anyway).
There is a sample app for this, Dr. Edit, on Google Drive's documentation.
UPDATE (Jul 2018) The Google Docs team pre-announced a forthcoming REST API at Google Cloud NEXT '18. Developers interested in getting into the early access program for the new API should register at https://developers.google.com/docs. The original answer below still stands as the REST API will become the second way you can access Google Docs programmatically.
Original answer (Mar 2017): (Most other answers are outdated.) Google Docs does not currently have a REST API, however developers can programmatically access (CRUD) documents using Google Apps Script, server-side JavaScript apps that are hosted at and run in Google's cloud. If you're new to Apps Script or to editing Google Docs with it, here are some learning resources:
Simple example: if you have an existing Doc with a (Drive) file ID of
DOCUMENT_ID_GOES_HERE
, here's how you'd basically edit it with Apps Script, doing a pseudo "mail merge" of name & email into the document given placeholders{NAME}
and{ADDR}
:The Document List API has been deprecated since September 2012 and looks like it could be retired after April 2015.
Updating the HTML version using the Drive API, as the question suggests, looks to be the only other way. I have been trying this and I have experienced a few of issues.
There may be more issues. These are just the ones I have found in the last few days.