Array.push.setAnyFormatting ('rojo')?

Descripción:

El usuario de Stack Overflow mhawksey recientemente hizo algooptimización fantástica de mi código, y al hacerlo, me presentó a los empujes de matriz súper eficientes. Pero trabajar con matrices es un poco difícil, porque parece que no puedo usar las funciones que puedo cuando uso el enfoque tradicional .getRange / .setValue.

Problema:

Necesito integrar .setFontColors ('rojo') y .setBackgroundColors ('blanco').

Código e imágenes:

Primero, publicaré el código. Segundo, una imagen de lo que elactualmente El código lo hace. En tercer lugar, una imagen de lo que el códigonecesidades que hacer.

function format() {

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var s = ss.getActiveSheet();
  var lastRow = s.getLastRow();
  var row;

  //gets a [][] of all values in the column
  var data = s.getRange("A:A").getValues();
  //we are going to build a [][] to output result
  var output = [];

  //loop through all cells in column A
  for (row = 0; row < lastRow; row++) {
    var cellValue = data[row][0];
    var dash = false;
    if (typeof cellValue === 'string') {
      dash = cellValue.substring(0, 1);
    //if a number copy to our output array
    } else {
      output.push([cellValue]);
    }

    //if -dash
    if (dash === "-") {
      //build first + last name
      var name = (data[(row+1)][0]+" "+data[(row+2)][0]).trim();
      //add row for the -state (e.g. -MI)
      output.push([cellValue]);
      output.push([name]);
      output.push(["Order complete"]);
      //add a blank row
      output.push([""]);
      //jump an extra row to speed things up
      row++;
    }
  }
  //set the values we've made in our output [][] array
  s.getRange(1, 1, output.length).setValues(output);
}

Esto es lo que hace el código:

Esto es lo que estoy tratando de lograr:

Actualizar:

He añadido un bucle de formato simple y funcional. El problema es que cuando lo ejecuto en una columna de datos más larga, el procesamiento tarda demasiado. Por lo que entiendo de los comentarios, no puedo formatear rápidamente una hoja de cálculo. ¿Me equivoco?

Código de formato adjunto:

//other variables
var range1;

  //loop through column A
  for (var row = 0; row < lastRow; row++) {
    range1 = s.getRange(row + 1, 1);

    //define offsets for if statement
    var offset1 = range1.offset(1, 0);
    var offset2 = range1.offset(2, 0);

    //substring cannot run on numbers, so...
    cellValue = range1.getValue();
    if (typeof cellValue === 'number') {continue;};
    dash = cellValue.substring(0, 1);

    //if -
    if (dash === "-") {
       offset1.setFontColor('red');
       offset2.setBackground('green');
     };
   };

Respuestas a la pregunta(2)

Su respuesta a la pregunta