Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
assert the length of columns in google sheets

The below code filters google spreadsheet based on the boolean expression below. Code thanks to https://stackoverflow.com/users/19043534/newaza

function DeleteEmptyRows() {

  const sheet = SpreadsheetApp.getActiveSheet()
  const values = sheet.getDataRange()
                      .getValues()
                      .filter(row => row[9] !== '' && row[7] !== '' && row[6] !== '')

  sheet.getDataRange().clearContent()

  return sheet.getRange(1, 1, values.length, values[0].length)
              .setValues(values)                      

}

Nevertheless, I am having an issue that some records are being deleted even not matching the boolean expression. Is there a way to assert that the lengths of row[9] row[6] and row[7] in the sheet before and after filter-operation ?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

so The Error was caused by the boolean expression! Nevertheless, @Tanaike suggestion helps to debug column length.

  function delDups() {

    const sheet = SpreadsheetApp.getActiveSheet();
    const orgValues = sheet.getDataRange().getValues();
    console.log(orgValues.length);
    const values = orgValues.filter(row => !(!row[7] && !row[6]));
  
    sheet.getDataRange().clearContent();
    console.log(values.length);
    return sheet.getRange(1, 1, values.length, values[0].length)
                .setValues(values);                  
  
  }
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda