如何在Google工作表中为多个单元格更新创建时间戳? [英] How to create timestamp in Google sheet for multiple cells update?
本文介绍了如何在Google工作表中为多个单元格更新创建时间戳?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经以反映现在工作簿中所有工作表的方式组合了这两个脚本.
I have combined both the scripts in a way that reflects in all the sheets in a workbook now.
此处更新了脚本:
function onEdit(e) {
var sheet = e.source.getActiveSheet()
{sheet.getRange('G3').setValue(new Date()).setNumberFormat("dd-MMM-yy at HH:mm");
}
if ([2,3,4,5].indexOf(e.range.columnStart) != -1)
{sheet.getRange('F6:F').setValue(new Date()).setNumberFormat("dd-MMM-yy at HH:mm");
}
}
我的查询是:
当B,C,D,E列中的任何一列被编辑时,时间戳记将在F列的相应单元格中记录.
When any of the B,C,D,E columns get edited, the time stamp noted in the respective cell in column F.
我已经尝试过,但是现在它反映在G列的所有单元格中.有人可以帮忙吗?
I have tried but it reflects in all the cell of column G now. Can anybody please help.
推荐答案
如果要获取已编辑的行,可以使用e.range.rowStart
.这样,您可以获得当前的F行范围:
If you want to get the edited row, you can use e.range.rowStart
. With that, you can get the current F row range:
sheet.getRange('F'+e.range.rowStart)
这篇关于如何在Google工作表中为多个单元格更新创建时间戳?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文