0
votes

I have a google spreadsheet with numerical data and month names on top.

Is there any way to copy conditional formatting from the bottom row (numerical) to the top one (month names)?

For example, highlight 'April' in green and 'August' in red?

Formatting top row based on the values of the bottom row won't work, since data can change a lot.

g-sheet

1

1 Answers

1
votes

How about this:

function copyColors() {
  var ss=SpreadsheetApp.getActive();
  var sh=ss.getSheetByName('Sheet1');
  var cA=sh.getRange(sh.getLastRow(),2,1,sh.getLastColumn()-1).getBackgrounds();
  sh.getRange(1,2,cA.length,cA[0].length).setBackgrounds(cA);
}