Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. /**
  2. * Automatically puts the current date in the first column of the edited row
  3. */
  4. function onEdit(event){
  5. var sheet = event.source.getActiveSheet();
  6. var debugCell = sheet.getCell(10,10);
  7. debugCell.setValue("DEBUG CELL"); // if anything works, this should show up... but it doesn't :C
  8.  
  9. var editedCell = sheet.getActiveCell();
  10. var dateCol = 0;
  11. var dateCell = sheet.getCell(editedCell.getRow(), dateCol);
  12.  
  13. debugCell.setValue(editedCell.getColumn());
  14.  
  15. if(!dateCell.getValue() && editedCell.getColumn() != dateCol){
  16. dateCell.setValue(new Date());
  17. }
  18. }
  19.  
  20. function onEdit(event){
  21. var sheet = event.source.getActiveSheet();
  22. var debugCell = sheet.getRange(10,10);
  23. debugCell.setValue("DEBUG CELL"); // if anything works, this should show up... but it doesn't :C
  24.  
  25. var editedCell = sheet.getActiveCell();
  26. var dateCol = 1;
  27. var dateCell = sheet.getRange(editedCell.getRow(), dateCol);
  28.  
  29. debugCell.setValue(editedCell.getColumn());
  30.  
  31. if(!dateCell.getValue() && editedCell.getColumn() != dateCol){
  32. dateCell.setValue(new Date());
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement