python-samples icon indicating copy to clipboard operation
python-samples copied to clipboard

(FR) download (all) revisions of a googlesheet

Open covh opened this issue 5 years ago • 3 comments

Python version 3.7.3. OS Linux

revisions of gsheet (possibly someone else's)

Example python code how to (1) download all revisions metadata of a specific googlesheet id, and then
(2) download a certain range (here: A3:E12) (3) from a specific sheet ("tab") (here SHEETNAME) (4) in a specific version (here: 252)
(5) of all (or selected) older revisions of that googlesheet-id.

Thank you very much!


feature request related to a problem: Download hundreds of older versions (version history) of the same googlesheet, that has been heavily worked on during several months. It is a multi-sheet document, and I need only one "tab" (sheet) with the name SHEETNAME, and in that only a certain range (e.g. A3:E12).

Describe the solution you'd like One snapshot CSV per day would suffice, perhaps the last one in the evening. But simply all-revisions-into-CSV would be fine too.

Describe alternatives you've considered

  • spreadsheets/export?id=... = https://docs.google.com/spreadsheets/export?id={id}&revision=252&exportFormat=CSV&range=A3:E12&sheet=SHEETNAME
  • spreadsheets/d/{id}/gviz/tq ... = https://docs.google.com/spreadsheets/d/{id}/gviz/tq?tqx=out:csv&sheet=SHEETNAME&range=A3:E12&revision=252

somehow those approaches do not seem to work, because either the SHEETNAME is ignored, or the SPECIFIC REVISION.

I've made a beginning here but got stuck with the above question.


[ As a smaller side problem, I seem to be able to download the revision history of my own sheet, but not the revision history of someone else's sheet (even though it's accessible to everyone in the GUI) - or what am I doing wrong? ]


Thanks a lot

covh avatar Jul 07 '20 19:07 covh