0
votes

new to coding and doing some Google Apps Script.

Trying to set some custom formatting for a large workbook to make things more readable and usable.

Is it possible to use Apps Script to set a color based on if the Cell is a formula?

I can't seen to find anything that using getBooleanCondition() or the ConditionalFormatRuleBuilder

Also can't seem to look for a Cell's Type using Apps Script.

Any thoughts or ideas would be greatly appreciated.

1

1 Answers

1
votes

Set all formulas to green

function setAllFormulasToGreen() {
  var ss=SpreadsheetApp.getActive();
  var sh=ss.getActiveSheet();
  var rg=sh.getDataRange();
  var f=rg.getFormulas();
  var b=rg.getBackgrounds()
  f.forEach(function(r,i){
    r.forEach(function(c,j){
      if(c){b[i][j]='green'}
    });
  });
  rg.setBackgrounds(b);//sets all backgrounds at one time
}