I want to get return cell background color in a google script. The current function looks like
function BGColor(colorref) {
var sheet = SpreadsheetApp.getActiveSheet();
Logger.log(sheet.getRange(colorref).getBackground());
var color = sheet.getRange(colorref)
.getBackground();
return color;
}
Currently colorref must be a string, which means that the cell input on the spreadsheet side of things is like =BGColor("C2"). But this means that I must manually input what goes into the function, instead of just the cell values, which would look like = BGColor(C2).
How can I extract the name C2 from cell C2 instead of its value, which is some number.