Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function startAll() {
- startB();
- startE();
- startH();
- startK();
- }
- function startB(){
- startTime("B");
- }
- function startE(){
- startTime("E");
- }
- function startH(){
- startTime("H");
- }
- function startK(){
- startTime("K");
- }
- function startTime(column) {
- var timeNow = Utilities.formatDate(new Date(), "GMT+2:00", "''HH:mm:ss")
- var currentCell = findLastIndex(column);
- var nextCell = currentCell + 1;
- var sheet = SpreadsheetApp.getActiveSheet().getRange(column + nextCell).setValue(timeNow).setNumberFormat("HH:mm:ss");
- }
- function findLastIndex(column) {
- var lastRow = SpreadsheetApp.getActiveSheet().getMaxRows();
- var values = SpreadsheetApp.getActiveSheet().getRange(column + "1:" + column + lastRow).getValues();
- for (; values[lastRow - 1] == "" && lastRow > 0; lastRow--) {}
- return lastRow;
- }
- function clearAll() {
- SpreadsheetApp.getActiveSheet().getRange('B6:B26').setValue("");
- SpreadsheetApp.getActiveSheet().getRange('E6:E26').setValue("");
- SpreadsheetApp.getActiveSheet().getRange('H6:H26').setValue("");
- SpreadsheetApp.getActiveSheet().getRange('K6:K26').setValue("");
- }
Add Comment
Please, Sign In to add comment