I want to create a custom function for a Google Spreadsheet which can set background color of the cell according to the value of given cell as a input.
F3 should become RED when I write this function.
I have tried this script so far:
function setFillColors(input) {
var ss = SpreadsheetApp.getActiveSheet()
var range = ss.getRange('input');
const fillColors = range.getValues().map(row => row.map(color => color || null));
ss.getActiveCell().setBackgrounds(fillColors);
}
but I am getting the following error:
Error ReferenceError: setBackgrounds is not defined (line 5).
Please correct what I am doing wrong.