Manage Revisions

Google Drive keeps track of all changes made to a file by automatically creating a "revision history." This allows users to see who made edits and to revert to earlier versions of the same file.

With the Drive API, you can programmatically save new revisions of a file or query the revision history as detailed in the Revision reference.

Google Drive automatically purges (or "prunes") revisions in order to optimize disk usage. To prevent this from happening, you can set the boolean flag keepRevisionForever to true to mark revisions that you don't want Drive to purge.

Listing and downloading individual revisions

Once you get a list of a file's revisions, you can download the content of any revision by calling the revisions.get method with the parameter alt=media. Revisions for Google Docs, Sheets, and Slides can not be downloaded.

Publishing revisions

For Google Docs, Sheets, and Slides you can publish any revision to the web by setting the published property. If the file is created in a G Suite domain, the publishedOutsideDomain property indicates whether the revision is accessible by anyone or if it is restricted to users of the domain.

Published revisions do not reflect changes made to a file unless the publishAuto property is set. If that property is set to true, newer revisions of a file will be automatically published, overwriting the previous ones. This behavior is also controlled by the "Automatically re-publish when changes are made" checkbox in the Drive UI.

Tips and tricks

To learn more about revisions, you can watch the following video of Google engineers discussing related tips and tricks.

Send feedback about...