Change Text Colors
Change all of a specific color text to another specific color. Sheet (to copy) https://docs.google.com/spreadsheets/d/1mgZNIatPd4qEiyWycGxeubjyM6dyslIQNhWHQDCI6N4/edit#gid=0 Script: function changeColors() { const sh = SpreadsheetApp.getActiveSpreadsheet(); const ss = sh.getActiveSheet(); const oldColors =["#99ff66","#f4cccc"]; const newColors = ["#38761d","#990000"]; let r = ss.getRange(2,1,5,2); let fonts = r.getFontColors(); for (let i in fonts){ for (let j in fonts[i]){ if (oldColors.indexOf(fonts[i][j]) != -1) fonts[i][j] = newColors[oldColors.indexOf(fonts[i][j])]; } } r.setFontColors(fonts); } Connect with me: • [email protected] • spencerfarris.me • www.linkedin.com/in/spencer-farris/ • Twitter @FarrisSpencer • Google Product Expert support.google.com/docs/profile/12305
Download
0 formatsNo download links available.