How can I get the revision history in Google Docs using a script?
How can I get the revision history in Google Docs using a script?
How can I do it? Some ideas?
I can't believe it, but it seems to be impossible to get a revision-history version of a Google Docs "file" programmatically. I checked the Drive SDK thoroughly and it seems all we can do is download the Google Document in some other format (probably losing details on the conversion). There's no generating a new Google Document from the revision, or even restoring a revision over the current file.
So, you could "download" a specific revision-history as a docx and then re-upload it converting back to Google Docs (ugh!), and then access normally. To do so you'll have to enable the Drive API v2 advanced service (under the Resources menu). And use the Drive SDK reference (linked above) to get the revision history and do this manoeuvre.
It's possible you need to enable the Drive SDK (which you do in the Resources -> Advanced Google Services Menu) and then do something like this
To get the file ID use SpreadsheetApp.getActiveSpreadsheet().getId();
or DocumentApp.getActiveDocument().getId();
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.