I have this function to get the font color of a cell. The test function works fine (as a result I get hex code #ff0000
), but when I call the get_color()
function from a Google Spreadsheet, it returns #ERROR
. This appears to be because I get just a plain string value from the function argument, instead of a Range object. How I could achieve it?
Maybe there is a little bit easier way to get font color of text?
function test_get_color() {
var targetId = 'xxx'
var cell = SpreadsheetApp.openById(targetId).getSheetByName('Sheet1').getRange('B7');
Logger.log(get_color(cell));
}
function get_color(cell){
return cell.getFontColor();
}