Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Google Spreadsheet coloring code
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
You can’t perform that action at this time.