src/connectors/appscript-connector.js
/**
   * initConditionalFormat - Reset all conditional formatting defined in The
   * columnConditions.
   * @param {string} tabId The keys of tabConfigs. E.g. "testsTab"
   */
Reset all conditional formatting defined in The
columnConditions.
@param {string} tabId The keys of tabConfigs.
Reset all conditional formatting defined in The columnConditions . @param { string } tabId The keys of tabConfigs .
initConditionalFormat(tabId) {
    let rules = [];
    let tabConfig = this.tabConfigs[tabId];
    let sheet = this.getSheet(tabId);
    let propertyLookup = this.getPropertyLookup(tabId);
    let columnIndex = 1;
    propertyLookup.forEach(propertyKey => {
      let conditions = this.columnConditions[propertyKey];
      if (conditions && conditions.length > 0) {
        let range = sheet.getRange(tabConfig.skipRows + 1, columnIndex,
            sheet.getMaxRows() - tabConfig.skipRows, 1);
        let maxpoint = conditions[1],
          minpoint = conditions[0];
        let midpoint = minpoint+(maxpoint-minpoint)/2;
        let maxcolor = '#68bb50', mincolor = '#e06666';
        if (maxpoint < minpoint) {
          maxpoint = conditions[0];
          maxcolor = '#e06666';
          minpoint = conditions[1];
          mincolor = '#68bb50';
        }
        let rule =
            SpreadsheetApp.newConditionalFormatRule()
                .setGradientMaxpointWithValue(
                    maxcolor, SpreadsheetApp.InterpolationType.NUMBER, maxpoint)
                .setGradientMidpointWithValue(
                    '#ffd666', SpreadsheetApp.InterpolationType.NUMBER, midpoint)
                .setGradientMinpointWithValue(
                    mincolor, SpreadsheetApp.InterpolationType.NUMBER, minpoint)
                .setRanges([range])
                .build();
        rules.push(rule);
      }
      columnIndex++;
    });
    sheet.setConditionalFormatRules(rules);
  }
initConditionalFormat ( tabId ) { let rules = [ ] ; let tabConfig = this . tabConfigs [ tabId ] ; let sheet = this . getSheet ( tabId ) ; let propertyLookup = this . getPropertyLookup ( tabId ) ; let columnIndex = 1 ; propertyLookup . forEach ( propertyKey => { let conditions = this . columnConditions [ propertyKey ] ; if ( conditions && conditions . length > 0 ) { let range = sheet . getRange ( tabConfig . skipRows + 1 , columnIndex , sheet . getMaxRows ( ) - tabConfig . skipRows , 1 ) ; let maxpoint = conditions [ 1 ] , minpoint = conditions [ 0 ] ; let midpoint = minpoint + ( maxpoint - minpoint ) / 2 ; let maxcolor = '#68bb50' , mincolor = '#e06666' ; if ( maxpoint < minpoint ) { maxpoint = conditions [ 0 ] ; maxcolor = '#e06666' ; minpoint = conditions [ 1 ] ; mincolor = '#68bb50' ; } let rule = SpreadsheetApp . newConditionalFormatRule ( ) . setGradientMaxpointWithValue ( maxcolor , SpreadsheetApp . InterpolationType . NUMBER , maxpoint ) . setGradientMidpointWithValue ( '#ffd666' , SpreadsheetApp . InterpolationType . NUMBER , midpoint ) . setGradientMinpointWithValue ( mincolor , SpreadsheetApp . InterpolationType . NUMBER , minpoint ) . setRanges ( [ range ] ) . build ( ) ; rules . push ( rule ) ; } columnIndex ++ ; } ) ; sheet . setConditionalFormatRules ( rules ) ; }
initConditionalFormat - Reset all conditional formatting defined in The
 columnConditions.
initConditionalFormat - Reset all conditional formatting defined in The columnConditions .