Assign the value to cells with a colored background

30 views
Skip to first unread message

fix falcon

unread,
Nov 27, 2019, 7:48:54 AM11/27/19
to Google Apps Script Community
Dear friends of the forum, greetings ...
I have some results whose cell has a green background and other red ones. I would like to be able to assign the value of 0 to all cells with a red background and 1 to those with a green background
I have the code that allows me to place a colored background but I don't know how to make the code GAS for a conditional for this case.

function setBackground(color) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getSheets()[6]; //sheet 6
var range = sheet.getRange("O2:Q5");
range.setBackground("#ff0000");
}

The letters you see in each cell are not necessary but the value assigned according to the color.
I attached an image for you to see

I thank you in advance for your valuable collaboration.

Valor 1 para verdes.PNG
Reply all
Reply to author
Forward
0 new messages