daily pastebin goal
39%
SHARE
TWEET

Untitled

a guest Dec 10th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function onEdit(e){
  2.   var curDate = Utilities.formatDate(new Date(), "GMT+01:00", "hh:mm");
  3.   var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Test2');
  4.   var colInicio = e.range.getColumn();
  5.   var filaInicio = e.range.getRow();
  6.   var ref = e.range.getA1Notation(); // Notation tipe A1 or A1:B2
  7.   var range = e.range;
  8.   var colIndex = colInicio.getColIndex();
  9.   var rowIndex = filaInicio.getRowIndex();
  10.  
  11.   var watchRange1 = {
  12.     top : 11,         // start row
  13.     bottom : 109,     // end row
  14.     left : 3,        // start col
  15.     right : 11,        // end col
  16.   };
  17.  
  18.   var watchRange2 = {
  19.     top : 11,         // start row
  20.     bottom : 109,     // end row
  21.     left : 13,        // start col
  22.     right : 21,        // end col
  23.   };
  24.  
  25.   if(rowIndex >= watchRange1.top && rowIndex <= watchRange1.bottom &&
  26.   colIndex >= watchRange1.left && colIndex <= watchRange1.rigth &&
  27.   range.getValue() != 0){
  28.  
  29.     var DateCol1 = "K9"; //Cell you want to have the date
  30.     SpreadsheetApp.getActiveSheet().getRange(DateCol).setValue(curDate);
  31.     //Write the date in the cell
  32.  
  33.   }else if (rowIndex >= watchRange2.top && rowIndex <= watchRange2.bottom &&
  34.   colIndex >= watchRange2.left && colIndex <= watchRange2.rigth &&
  35.   range.getValue() != 0){
  36.  
  37.     var DateCol1 = "U9"; //Cell you want to have the date
  38.     SpreadsheetApp.getActiveSheet().getRange(DateCol).setValue(curDate);
  39.     //Write the date in the cell
  40.  
  41.   }else{
  42.     //if test
  43.     var DateCol1 = "K9";
  44.     SpreadsheetApp.getActiveSheet().getRange(DateCol).setValue("Fallo");
  45.   };
  46. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top