Last active
August 30, 2020 03:24
-
-
Save zacck-zz/c3a45c3137b5d8dbef9914bdc3166dd1 to your computer and use it in GitHub Desktop.
Race timing sheet automation for the August 2020 Funduro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function onSelectionChange() { | |
var s = SpreadsheetApp.getActiveSheet(); | |
if( s.getName() == "Sheet1" ) { //checks that we're on Sheet1 or not | |
var r = s.getActiveCell(); | |
if( r.getColumn() == 4) { //checks that the cell being edited is in column A | |
if( r.getValue() === '' ) //checks if the adjacent cell is empty or not? | |
var today = new Date().getTime(); | |
r.setValue(today); | |
} | |
if( r.getColumn() == 5 ) { | |
if( r.getValue() === '' ) | |
var today = new Date().getTime(); | |
r.setValue(today); | |
} | |
if( r.getColumn() == 6 ) { | |
var start = r.offset(0,-2); | |
var end = r.offset(0, -1); | |
var split = (end.getValue() - start.getValue()) / 1000 ; | |
r.setValue(split +"s"); | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment