Watch edit on google sheet cells

    0

    1

    Guntar Susatyo

    The code uses the getRow() and getColumn() methods of the Range object to get the row and column number of the cell in which the onEdit() function is being called, and then it accesses the sheet object for the sheet the user is currently editing (in this case, it's using the string "Prospek"). It then uses the getRange() method of the Sheet object to get the range of cells that intersect with the cell in which the onEdit() function is being called (in this case, the range starts at row 1 and goes up to row 11). It sets the value of the range's cell at the current date.

    Shortcut: sheetOnEditColumn

    function onEdit(e) {
      const row = e.range.getRow();
      const col = e.range.getColumn();
      const sheetProspek = "Prospek";
      const currentDate = new Date();
    
      if ((col === 17 || col === 22) && row > 1 && e.source.getActiveSheet().getName() === sheetProspek ) {
        e.source.getActiveSheet().getRange(row, 11).setValue(currentDate);  
      }
      
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.