I have the following definition:
format = SpreadsheetApp.newTextStyle()
.setForegroundColor(spec.textColor)
.setBold(spec.bold)
.build();
I want to modify it, but I have not been able so far. Some examples of unlucky attempts:
The following, returns the error: TypeError: format.setForegroundColor is not a function: format.setForegroundColor("green");
The following, returns the error: TypeError: format.getTextStyle is not a function: format.getTextStyle().setForegroundColor("yellow");
The following does nothing: format.setForegroundColor = "green";
The following DO work, but it does not seem a proper/elegant solution (as we are basically creating the variable again instead modifying a value of it):
format = SpreadsheetApp.newTextStyle()
.setForegroundColor("green")
.setBold(spec.bold)
.build();
How to properly modify the foreground color or bold attribute?