gimite/google-drive-ruby — pull request #48 by ocouronne (2013-03-05 18:58:54+00:00)
Title: Date Worksheet Updated

I added updated to be able to know when the worksheet was last updated.

It allows me to do something like this:

ws = session.spreadsheet_by_title(spn).worksheet_by_title(wsn)
ss = ws.spreadsheet

updatedWorksheet = Time.parse(ws.updated)
updatedLocalFile = File.mtime(localFilename)

# get the file only if it was modified
if updatedWorksheet > updatedLocalFile then
# find the sheet name (od6 etc)
ws.worksheet_feed_url =~ %r{^https?://spreadsheets.google.com/feeds/worksheets/(.*)/private/full/(.*)$}
# then simply export (I have to reconstruct the file because I am now in data)
ss.export_as_file(localFilename, format="tsv", GID_TABLE[$2])
end