Created
February 7, 2014 17:57
-
-
Save alexkingorg/8868105 to your computer and use it in GitHub Desktop.
Google Spreadsheet coloring code
This file contains hidden or 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 onEdit(e) { | |
setColors(); | |
}; | |
function setColors() { | |
var activeSheet = SpreadsheetApp.getActiveSheet(); | |
var numRows = activeSheet.getMaxRows(); | |
var numCols = activeSheet.getMaxColumns(); | |
var row, cell, value; | |
// immediate rejections | |
for (var i = 1; i <= numRows; i++) { | |
row = activeSheet.getRange(i, 1, 1, numCols); | |
cell = activeSheet.getRange(i, 15); | |
value = cell.getValue(); | |
if (value == ‘1’) { | |
row.setBackground(‘#999’); | |
} | |
else { | |
row.setBackground(‘#fff’); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment