用于显示最近更改历史的脚本

时间:2015-10-18 20:09:01

标签: javascript google-sheets

请帮助结束Google表格上的某些脚本。现在它就像:



function onEdit(event)
{ 
  
  var sheet = event.source.getActiveSheet();
  
  // Note: actRng = return the last cell of the row modified
  var actRng = event.source.getActiveRange();
  var index = actRng.getRowIndex();
  var cindex = actRng.getColumnIndex();
  
  // Note: date = return date + time
  // Note: user = return the user email
  var dateCol = sheet.getLastColumn();  
  var lastCell = sheet.getRange(index,dateCol);
  var date = Utilities.formatDate(new Date(), "GMT+0300", "dd-MM-yy HH:mm");
  
  //var user = event.user;  // Note: event.user will not give you collaborator's Id
  var user = Session.getEffectiveUser();
  
  // Note: setcomment = Inset a comment with the user email
  // Note: setValue = Insert in the cell the date + time when this row was modified
  lastCell.setValue("'" + date + " " + user).setComment(user);
}




end acts like enter image description here

因此,当您将鼠标放在带有日期和时间的单元格上时,它会显示最后一次更改的人的电子邮件地址,至少是最后一次更改。

有关如何更改此代码的任何帮助或建议?

0 个答案:

没有答案