Last active
August 26, 2016 16:01
-
-
Save ja6lee/05e6e5b2afcb6b7762fea133148ce1a5 to your computer and use it in GitHub Desktop.
Update the color of a cell in a Google Spreadsheet to match the color specified in the cell.
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 onEdit(e) { | |
var range = SpreadsheetApp.getActiveSheet().getDataRange(); | |
for (var j = range.getColumn(); j <= range.getLastColumn(); j++) { | |
for (var i = range.getRow(); i <= range.getLastRow(); i++) { | |
var cell = range.getCell(i, j); | |
var status = cell.getValue(); | |
if (status[0] == '#') { | |
cell.setBackground(status); | |
} else { | |
cell.setBackground('#ffffff'); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
this is cool man