I want to color my cels with 3 colors of text, is possible via conditional formating of JS? TY !
Example.
8♠ 6♦ 5♣
CodePudding user response:
CodePudding user response:
const spreadsheet = SpreadsheetApp.getActiveSpreadsheet()
const sheet = spreadsheet.getSheetByName('Sheet1')
function changeColor() {
const range = sheet.getRange("A1:A5");
const values = range.getValues()
black = SpreadsheetApp.newTextStyle()
.setForegroundColor("black")
.build();
blue = SpreadsheetApp.newTextStyle()
.setForegroundColor("blue")
.build();
green = SpreadsheetApp.newTextStyle()
.setForegroundColor("green")
.build();
for (value of values){
richText = SpreadsheetApp.newRichTextValue()
.setText(value)
.setTextStyle(0, 2, black)
.setTextStyle(3, 5, blue)
.setTextStyle(6, 8, green)
.build();
range.setRichTextValue(richText);
}
}