使用Sheets API v4获取Google表格上次修改日期(Java) [英] Get Google Sheets Last Edit date using Sheets API v4 (Java)

查看:272
本文介绍了使用Sheets API v4获取Google表格上次修改日期(Java)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Android中使用Google Sheets API v4。



我会喜欢做这样的事情:

  Spreadsheet spreadsheet = sheetsService.spreadsheets()。get(spreadsheetId).setIncludeGridData(true)。执行(); 
日期日期= spreadsheet.getProperties()。getLastEditDate();

但是,当然,没有这样的 getLastEditDate()属性方法存在。是否有一个参数或另一个API方法来获取这些数据?



更好的办法是获取每个单元格的修改日期......

em>,但是我会为整个电子表格或工作表的日期作出决定。

解决方案

这不适用于Sheets API ,但是您可以使用云端硬盘API的 files.get 方法,在响应中包含'modifiedTime'。 (请注意,默认情况下,它不会包含修改时间,您必须在'fields'参数中明确要求它。)


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:

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.

解决方案

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.)

这篇关于使用Sheets API v4获取Google表格上次修改日期(Java)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆