16

I have an Excel sheet document on Google Docs with several revisions. I want to download one of its older versions to my machine.

How can I do this?

(Google Docs allows downloading the latest version directly from File > Download as, and I didn't find any way download the revisions.)

15

If you download the current version of your document, right-click on the download in the Downloads window of your browser (Firefox) and copy the URL. Then simply append &revision=NNN and paste this new URL into your browser address bar and hit enter. It will download that specific revision.

So the only exercise left is finding out which revision ID you need to use.

In order to do that, visit developers.google.com revisions list and click on Try it now, then enter the fileId of your document, which is the long string of characters and numbers between docs.google.com/document/d/ and the next slash in your browsers URL bar when editing the document. It's also visible in the download URL you copied before. Paste that into the fileId on the API explorer page an hit Authorize and execute.

Scroll down to the response, look at the modifiedTime and choose the correct number from the id field. Then use that number to download your document. The final URL should look something like this:

docs.google.com/document/u/0/d/XXXX/export?format=docx&revision=NNN

Where XXXX is the fileId and NNN is your revision number.

  • 1
    Upvote this!!! Confirmed working for Google Sheets as well. Do note that the time shown in the JSON response is in GMT, so while the revision history proper shows the time stamps in your local time zone, you need to convert that to GMT before you can find the exact revision. – ADTC Apr 17 '16 at 17:31
  • @ADTC: a year later doesn't seem to be working. Does it still works for you? – Adobe May 30 '17 at 15:28
  • @Adobe just tried, it works but you may have a hard time finding the correct revision ID from the API. Is that where you're stuck? – ADTC May 31 '17 at 4:00
  • @Adobe maybe this additional trick will help you find the revision ID you want. If you couldn't find the GMT timestamp you were looking for, look for nextPageToken at the very top of the JSON response. Put this value into the pageToken field and Execute again. This will give you a new JSON response with more revision IDs. Keep doing this until you find the revision ID you want. – ADTC May 31 '17 at 4:10
  • @ADTC: thanks, on the second try I had some kind of success: webapps.stackexchange.com/a/106553/14417. However, I don't seem to have "nextPageToken" at the json response. – Adobe May 31 '17 at 5:39
8
  • Go to FileSee Revision History
  • Select the version you want then click Restore this version

This won't delete any versions — you will still be able to go back to the current version.

The full article can be found here.

  • 1
    But this is forcing me to restore to an older version which I don't want because other users are view/editing document at the same time. Any other approach? – Ramesh Soni Oct 21 '10 at 12:35
  • @RameshSoni that's exactly what fhackenberger's answer avoids! – ADTC Apr 17 '16 at 17:32
1

I tried doing what fhackenberger suggested but it didnt work as it retrieved only last few revisions and I wanted almost a month old version.

But I did find a very easy way to download it. When seeing version history, after you select the version you want under version history to the right, click on the options(three vertical dots on the top right corner of the highlighted version) and select "Make a Copy". This downloaded the version i wanted

1

When you look at the version history, there are 3 dots next to each version. You can make a copy of a version and save it wherever you want and download.

0

Using Chrome, I'm able to do this for spreadsheets (but not docs unfortunately) :

  1. Go to File > See Revision History
  2. Display the revision you want to download
  3. UnClick "Show Changes" (if you don't want to see the changes"
  4. Right click on your document and select "View Page Source"
  5. Remove the view-source: from

this will give you the revision in HTML

  • An HTML page? No thanks. I want the proper export. – ADTC Apr 17 '16 at 17:32
0

I ended up with this https://docs.google.com/spreadsheets/u/0/d/DID/export?format=xlsx&rev=RID&gid=SID&id=DID

Where:

  • DID - document ID (used twice)
  • RID - revision ID
  • SID - spreadsheet id (I have spreadsheet with many sheets and needed just one)

Ziad's answer helped to come to this link.

0

Automating fhackenberger's answer:

#!/usr/bin/env ruby

require 'json'
require 'active_support/core_ext/date' # required for timezone calculation; gem install activesupport
# require 'byebug'


# ========
## inputs:

jsonFile       = 'revisions.json' # file with json response obtained from https://developers.google.com/drive/v3/reference/revisions/list#try-it
docId          = 'you doc id' # e.g.: M67keINXrkCAPy9HyGEgyM5Q175yFM8byQeM953alao3
dateStartsWith = 'May 30'
format         = 'xlsx' # xlsx or docx
timezone       = 'Moscow' # list all timezones: ruby -e "require 'active_support/core_ext/date'; puts ActiveSupport::TimeZone.all.map(&:name)"


# =========
## program:

jsonString = File.read(jsonFile)
jsonData   = JSON.parse(jsonString)

# add local time stamps:
jsonData['revisions'].each { |rev| rev["localTimeStamp"] = Time.parse(rev["modifiedTime"]).in_time_zone(timezone).strftime("%b %e, %k:%M:%S %p, %Y") }

if format == 'xlsx'
  type = 'spreadsheets'
else
  format = 'docx'
  type = 'document'
end

revs = jsonData['revisions'].select {|rev| rev["localTimeStamp"].start_with?(dateStartsWith) }.each { |rev| rev["link"] = "https://docs.google.com/#{type}/u/0/d/#{docId}/export?format=#{format}&revision=#{rev['id']}" }

puts JSON.pretty_generate(revs)

Still somehow I get only some revisions, not all of them.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.