【发布时间】:2017-06-29 15:37:16
【问题描述】:
我在 Google 表格中有一个文档(我从事医疗保健模拟工作),该文档在主文件中有两个单独的表格(选项卡)。一个标签是 MAR,另一个是 VITALS。我需要每个都从同一个脚本中运行,并且不会相互干扰。我只能让一个工作,另一个不行。
我将在下面发布每一个(您将能够看到,当一个工作时,另一个不工作,但当另一个//rem'd out 时,每个都将工作)。
我不确定要更改哪些变量才能使它们共存并协同工作。我知道我一定错过了一些简单的东西。 谢谢您提前!
三月时间戳
function onEdit() {
var x = SpreadsheetApp.getActiveSheet();
if( x.getName() == "MAR" ) { //checks that we're on the correct sheet
var y = x.getActiveCell();
if( y.getColumn() == 4 ) { //checks the column
var nextCell = y.offset(0,1);
if( nextCell.getValue() === '' ) //is empty?
nextCell.setValue(new Date());
}
}
}
重要的时间戳
function onEdit() {
var x = SpreadsheetApp.getActiveSheet();
if( x.getName() == "Vitals" ) { //checks that we're on the correct sheet
var y = x.getActiveCell();
if( y.getColumn() == 1 ) { //checks the column
var nextCell = y.offset(0,1);
if( nextCell.getValue() === '' ) //is empty?
nextCell.setValue(new Date());
}
}
}
【问题讨论】:
标签: date time google-sheets