Created
April 14, 2014 16:01
-
-
Save dulichan/10661092 to your computer and use it in GitHub Desktop.
A Google Script for spreadsheets to covert a selection of cells to mins:secs
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 sensible_time() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var data = sheet.getActiveRange().getValues(); | |
for (var i = 0; i < data.length; i++) { | |
for (var j = 0; j < data[i].length; j++) { | |
if (data[i][j]) { | |
var range = sheet.getRange(24+i, j+1); | |
time = data[i][j]; | |
var mins = ~~(time / 60); | |
var secs = time % 60; | |
Logger.log(mins+":"+secs+""); | |
range.setValue(mins+":"+secs); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment