Skip to content

Instantly share code, notes, and snippets.

@battis
Last active April 11, 2024 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save battis/19a28fe9c378e4b631adbcef7c04b980 to your computer and use it in GitHub Desktop.
Save battis/19a28fe9c378e4b631adbcef7c04b980 to your computer and use it in GitHub Desktop.
List revisions for a Google Drive file
/*
* Seth Battis
* Google Apps Script
* No external dependencies
*/
function fileHistory(fileId) {
const response = JSON.parse(UrlFetchApp.fetch(`https://www.googleapis.com/drive/v3/files/${fileId}/revisions`, {
headers: {
Authorization: `Bearer ${ScriptApp.getOAuthToken()}`
}
}))
Logger.log(JSON.stringify(response.revisions, null, 2));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment