I’m writing a UDF and get an error. From the documentation, it seems straightforward. My goal is to check the background color of a cell. The code is shown below and the calling format is “isColor(cell)”. I get an error (Range not found (line 5, file “Code”) on the line var cell = ...
I tried to pass the cell address as a string by making the calling format isColor(cell("address",A2))
function isColor(input) { var ss = SpreadsheetApp.getActiveSpreadsheet(); var sheet = ss.getSheets()[0]; Logger.log(input); var cell = sheet.getRange(input); var color = cell.getBackground(); Logger.log(cell); color = cell.getBackground(); Logger.log(color); var result = false; if (color == '#ffffff') { result = false;} else { result = true; } return result; }