【发布时间】:2023-04-02 04:00:02
【问题描述】:
情况:
我有以下在 OnEdit 中运行的脚本,但我想调整此脚本以仅在有人向工作表添加新行时运行。
脚本:
function DataValidation2(e)
{
var ss = SpreadsheetApp.getActiveSpreadsheet();
var s = ss.getActiveSheet();
if (s.getName() == "Sheet1"){
var cell = s.getRange('C3:C');
var rule = SpreadsheetApp.newDataValidation().setAllowInvalid(false).requireValueInList(['0:15:00', '0:20:00']).build();
cell.setDataValidation(rule);
}
}
如果可能,仅当有人在工作表末尾使用 boton add include 添加新行时才执行此脚本?
最好的问候,
【问题讨论】:
标签: events google-apps-script google-sheets