Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get Google Sheets Last Edit date using Sheets API v4 (Java)

I'm using the Google Sheets API v4 in Android.

https://developers.google.com/sheets/api/quickstart/android

I need to know when the last modification to the sheet was made (including by user); I need this guy:

enter image description here

I'd like to do something like this:

    Spreadsheet spreadsheet = sheetsService.spreadsheets().get(spreadsheetId).setIncludeGridData(true).execute();
    Date date = spreadsheet.getProperties().getLastEditDate();

But, of course, no such getLastEditDate() property method exists. Is there a parameter or another API method to call to get this data?

Even better would be to get the modified date for each cell... but I'd settle for the date of the entire spreadsheet or sheet.

like image 383
LimaNightHawk Avatar asked Apr 14 '17 12:04

LimaNightHawk


1 Answers

This is not available in the Sheets API, but you may be able to use the Drive API's files.get method, which includes a 'modifiedTime' in the response. (Note that by default it will not include the modified time, you have to explicitly ask for it in the 'fields' parameter.)

like image 197
Sam Berlin Avatar answered Oct 02 '22 20:10

Sam Berlin