Apply Multiple Font Colors To The Text In A Single Google Sheets Cell
Answer : As on July 2018, Apps-Script support changing individual text colors and other font related styles. Two methods are added to SpreadsheetApp . newTextStyle() and newRichTextValue() . The following apps-script changes such fontstyles in A1. For best effects, Use a lengthy string(30 characters or more). function rainbow(){ var rng = SpreadsheetApp.getActiveSheet().getRange("A1"); var val = rng.getValue().toString(); var len = val.length; // length of string in A1 var rich = SpreadsheetApp.newRichTextValue(); //new RichText rich.setText(val); //Set Text value in A1 to RichText as base for (var i=0;i<len;i++){ //Loop through each character var style = SpreadsheetApp.newTextStyle(); // Create a new text style for each character var red= ("0"+Math.round((1/len)*(i)*255).toString(16)).substr(-2,2); // var green= ("0"+Math.round((1/len)*Math.min(i*2,len-Math.abs(i*2-len))*255).toString(16)).substr(-2,2); // var blue= (...