Reputation: 313
Sorry, I am a beginner in script development. Just tried to access the background color of a cell (returned as color string) and being stuck with the error message "TypeError: getrange is not a function" in line 4.
function GetCellColor(input)
{
var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet()
var cell = ss.getrange(input);
var result = cell.getBackground();
return result
}
I want to use it in a spreadsheet with reference to any other cell like
=GetCellColor(D24)
Upvotes: 0
Views: 6326
Reputation: 4419
You are using the method Sheet.getRange(a1Notation) which takes a string as a parameter. So to answer the question from your comment you can't. But you could build the R1C1 notation string using other methods and concatenation which you could the use for copying and pasting.
=GetCellColor("R"&ROW()&"C"&COLUMN())
Upvotes: 1