相关疑难解决方法(0)

同一张表中的多个 OnEdit Google 脚本 - 它们单独工作,一起工作不太好

我让这些脚本单独工作,但是当我将它们组合起来或创建两个不同的脚本时,只有一个脚本可以运行。如果发现条件格式工具使我的电子表格陷入困境,那么我使用第一个脚本来替换该函数,它使一切变得不同。第二个脚本只是一个存档脚本,用于将行移动到存档表。无论我将它们与谁组合在一起,一次只能有一个起作用。我尝试过两个单独的脚本并尝试组合。包括更改函数名称so。我缺少什么?

function onEdit(e) {
if (e) { 
    var ss = e.source.getActiveSheet();
    var r = e.source.getActiveRange(); 

        // E.g. status column is 2nd (B)
        status = ss.getRange(r.getRow(), 2).getValue();

        // Specify the range with which You want to highlight
        // with some reading of API you can easily modify the range selection properties
        // (e.g. to automatically select all columns)
        rowRange = ss.getRange(r.getRow(),3,1,8);

        // This changes font color
        if (status == 'Complete') {
            rowRange.setFontColor("#d3d3d3");
            rowRange.setBackgroundColor("#FFFFFF");
        } else if (status == 'This Week') { …
Run Code Online (Sandbox Code Playgroud)

google-sheets google-apps-script

2
推荐指数
1
解决办法
8501
查看次数

合并或组合两个 onEdit 触发函数

我有在互联网上收集的 Google Sheets 脚本,并在这里获得了一些帮助。不,我有两个onEdit冲突。我通过为onEdit2. 它有效,但我不认为这是最好的解决方案。您能帮忙将这两个函数onEdit用 if 函数合二为一吗?

//Dependent Dropdown list
function onEdit(e){ // Function that runs when we edit a value in the table.
  masterSelector(master1,master2,master3,master4);
  var activeCell = e.range; // It returns the coordinate of the cell that we just edited.
  var val = activeCell.getValue(); // Returns the value entered in the column we just edited.
  var r = activeCell.getRow(); // returns the row number of the cell we edit.
  var c = activeCell.getColumn(); …
Run Code Online (Sandbox Code Playgroud)

javascript triggers google-sheets google-apps-script

1
推荐指数
1
解决办法
660
查看次数