1

I want to iterate through all previous versions of a Google sheet and extract some information from all the versions along with version timestamp.

Is there any easy to do so? I couldn't find any API which could loop through the previous versions.

Aditya Abhas
  • 174
  • 11
  • Are these thread useful? https://stackoverflow.com/q/56213790/7108653 https://stackoverflow.com/q/57387113/7108653 – Tanaike Feb 12 '22 at 00:23
  • @Tanaike these are both useful but also both assume that you know the revisionId. Is there any way to loop through all revisions to find the appropriate one (e.g. using the time stamp)? ps. I'm unable to use the user interface here https://developers.google.com/drive/api/v3/reference/revisions/get due to admin settings, so won't be able to look there for the Id. – a-burge Mar 07 '22 at 13:04

1 Answers1

1

You could try using the Revision.list method to retrieve the Revision history of a file. Referencing this answer from a similar thread looks like you will need to download and re-upload back the file so you can have the specific version that you want available as there is no way to make a copy programatically using the Revisions Drive API.

Gabriel Carballo
  • 1,278
  • 1
  • 3
  • 9
  • 1
    Every time I run revision.list I only get the latest version of the file and list.lenght is equal to one. Do you know how to list the different versions that you would see in the gui? – a-burge Mar 07 '22 at 13:01
  • My results are limited to three for a file that has thousands of revisions :( – AsTeR May 31 '23 at 10:10