我使用这个脚本并且效果很好,除了两件事:
脚本:
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
var r = s.getActiveCell();
if( r.getColumn() != 11 ) { //checks the column
var row = r.getRow();
var time = new Date();
time = Utilities.formatDate(time, "CST", "yyyy-MM-dd");
SpreadsheetApp.getActiveSheet().getRange('P' + row.toString()).setValue(time);//Enters date in Column P
};
};
答案 0 :(得分:0)
我想出了部分内容。如何跳过第一行(HEADER ROW)第二部分应该更容易一些。补充说:
var headerRows = 1; // # header rows to ignore
if (r.getRow() <= headerRows) return;
全文:
function onEdit() {
var s = SpreadsheetApp.getActiveSheet();
var r = s.getActiveCell();
if( r.getColumn() != 11 ) { //checks the column
var row = r.getRow();
var headerRows = 1; // # header rows to ignore
if (r.getRow() <= headerRows) return;
var time = new Date();
time = Utilities.formatDate(time, "CST", "yyyy-MM-dd");
SpreadsheetApp.getActiveSheet().getRange('P' + row.toString()).setValue(time);//Enters date in Column P
};
};