How to get Google docs last edit date

家住魔仙堡 提交于 2019-12-04 02:05:20

In Google Apps Script there is a DriveApp service that you can use. Something like this will work:

function lastUpdatedOn() {
  var FILE_ID = 'FILEID';

  return DriveApp.getFileById(FILE_ID).getLastUpdated();
}

The documentation for that is here: https://developers.google.com/apps-script/reference/drive/file#getlastupdated

Hope that helps.

Use the Update method of the Files resource, enabling the 'setModifiedDate' boolean to true. This parameter will modify the timestamp of the file edition date, whenever the file has any type of modification.

The best way to go might be to go into the Tools menu and use the "Script editor". A little bit of code makes this not so difficult. Here's one example I found that seems to work.

function onEdit(event) { var ss = event.source.getActiveSheet(); if (ss.getName() === 'Locations') { var dd = new Date(); ss.getRange(event.range.rowStart, 8).setValue(dd.toISOString()); } }

In addition to the code you will need to accept some security dialog question, and you will need to setup a "trigger" for the project. These "triggers" are how you associate the code with an event in the Google Spreadsheet.

Hope this helps.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!