Is it possible to access revision history data of a spreadsheet directly from Google Apps Scripts? If so, how?
I would like to do two things:
If the above is not possible, then
I don't believe it's possible to access the revision history with Apps Script. There is an open feature request for this ability though, and if you star it you'll receive an email when there is an update:
http://code.google.com/p/google-apps-script-issues/issues/detail?id=394
It's not possible to change data from the revision history.
AFAIK there is no way to get data from a spreadsheet old revision, ie, number of sheets, sheets names, etc., but nowadays it's possible to get some metadata of some spreadsheet revisions by using the Advanced Drive Service
function logRevisionMetadata() {
const fileId = 'put here your spreadsheet ID';
const output = [];
// Get revisions
var revisions = Drive.Revisions.list(fileId, { 'maxResults': 1000 });
console.log("Found " + revisions.items.length + " revisions");
revisions.items.forEach( revision => {
var date = new Date(revision.modifiedDate);
output.push([Utilities.formatDate(date,'GMT-5','yyyy-MM-dd HH:mm'), revision.lastModifyingUser.displayName]);
});
console.log(output)
}
When I ran the above code for one of my spreadsheets I got only 24 revisions (only revisions from the current month and some of the previous month, the revisions from the previous 5 months were missing). This was already reported in the issue tracker Google Drive revision.list() does not return all stored revisions for a Google Sheets Spreadsheet
Related
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.