daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 48 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function startAll() {
  2.   startB();
  3.   startE();
  4.   startH();
  5.   startK();
  6. }
  7.  
  8. function startB(){
  9.   startTime("B");
  10. }
  11. function startE(){
  12.   startTime("E");
  13. }
  14. function startH(){
  15.   startTime("H");
  16. }
  17. function startK(){
  18.   startTime("K");
  19. }
  20.  
  21. function startTime(column) {
  22.   var timeNow = Utilities.formatDate(new Date(), "GMT+2:00", "''HH:mm:ss")
  23.   var currentCell = findLastIndex(column);
  24.   var nextCell = currentCell + 1;
  25.   var sheet = SpreadsheetApp.getActiveSheet().getRange(column + nextCell).setValue(timeNow).setNumberFormat("HH:mm:ss");
  26. }
  27.  
  28. function findLastIndex(column) {
  29.   var lastRow = SpreadsheetApp.getActiveSheet().getMaxRows();
  30.   var values = SpreadsheetApp.getActiveSheet().getRange(column + "1:" + column + lastRow).getValues();
  31.  
  32.   for (; values[lastRow - 1] == "" && lastRow > 0; lastRow--) {}
  33.   return lastRow;
  34. }
  35.  
  36. function clearAll() {
  37.   SpreadsheetApp.getActiveSheet().getRange('B6:B26').setValue("");
  38.   SpreadsheetApp.getActiveSheet().getRange('E6:E26').setValue("");
  39.   SpreadsheetApp.getActiveSheet().getRange('H6:H26').setValue("");
  40.   SpreadsheetApp.getActiveSheet().getRange('K6:K26').setValue("");
  41.  
  42. }
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