Google sheets 多准则时间戳
我正在使用Google sheets 多准则时间戳,google-sheets,Google Sheets,我正在使用 function onEdit() { var s = SpreadsheetApp.getActiveSheet(); var r = s.getActiveCell(); var time = new Date(+new Date + (1000 * 60 * 60 * 24 * 7)); time = Utilities.formatDate(time, "GMT-08:00", "MM/dd/yyyy"); if( r.getColumn() == 2
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
var r = s.getActiveCell();
var time = new Date(+new Date + (1000 * 60 * 60 * 24 * 7));
time = Utilities.formatDate(time, "GMT-08:00", "MM/dd/yyyy");
if( r.getColumn() == 2 ) { //checks the column
var nextCell = r.offset(0, 6);
if( nextCell.getValue() === '' ) //is empty?
nextCell.setValue(time);
}
}
…向H列添加时间戳+7天
除了这个时间戳功能。。。(可能是另一个脚本)
正确,如果不先将原始数据复制到其他地方,使用onEdit是不可能的。这是我目前专业知识范围内的一个复杂解决方案。也许可以试试这样的解决方案
function onEdit(e) {
var d = new Date(new Date() + (1000 * 60 * 60 * 24 * 7));
var time = Utilities.formatDate(d, "GMT-08:00", "MM/dd/yyyy"),
ind = [2, 4].indexOf(e.range.columnStart),
off;
if (ind == 0) {
off = 6;
} else if (ind == 1 && e.value !== "Questions/Waiting for Info") {
off = 4;
}
e.range.offset(0, off).setValue(time)
}
当D列更改为除“问题/等待信息”之外的任何内容,并且“12/31/1969”是新的时间戳时,此功能将起作用。这里的主要问题是,我认为onEdit函数不起作用。我还忘了另外一个标准,认为这个问题太夸张了。请参阅上面我的编辑。谢谢