I am trying to loop over one column in my sheet and set the value an adjacent cell dependent upon the value and color of the active cell. this is what I've tried but I cannot seem to get working...
function setValue(){
var sheet = SpreadsheetApp.getActiveSpreadsheet();
var end = SpreadsheetApp.getActiveSheet().getLastRow();
for( var i = 1; i < end + 1; ++i){
var value = sheet.getRange(i, 4).getValue();
var color = sheet.getRange(i, 4).getColor();
if (value == "Authenticated" && color == "#ffffff") {
sheet.getRange(i, 5).setValue("True");
}
else {
sheet.getRange(i, 5).setValue("False");
}
}
}
UPDATE:
Thank you! I have a very large dataset so this function times out. I was thinking of making it a one cell at a time function. I've tried this but I can't seem to get the color of the inputValue cell's background color...
function setKeep(inValue){
var sheet = SpreadsheetApp.getActiveSheet();
var cell = sheet.getActiveCell();
var color = cell.getBackgroundColor();
var outValue = "";
if (inValue == "AUTHENTICATED" && color == "white"){
outValue = "TRUE";
}
else{
outValue = "FALSE";
}
return outValue;
}