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

141
Vistas
How to iterate over a range and an array of data and set the iterated array values until there's no data using GAS?

This may seem simple to you, but well....here I am.

The code below sets apparently the last value Mangas to all cells in the rangeList , while it should set Alca to A10, Mangas to F10 and stop, because there are only 2 elements.

const rngs = ["A10", "F10", "J10", "A12", "F12", "J12"];
const rangeList = sheetVendSobEnc.getRangeList(rngs).getRanges();
let coresPartes = ["Alca", "Mangas"]
  for (let a = 0; a < rangeList.length; a++) {
    for (let n = 0; n < coresPartes.length; n++) {
      rangeList[a].setValue(coresPartes[n])
    }
  }

Thank you in advance!

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

0

I think what you want is this?

const rngs = ["A10", "F10", "J10", "A12", "F12", "J12"];
const rangeList = sheetVendSobEnc.getRangeList(rngs).getRanges();
let coresPartes = ["Alca", "Mangas"]
  for (let a = 0; a < rangeList.length; a++) {
    if( coresPartes[a] ===  undefined ) return;  // or break i'm no sure
    rangeList[a].setValue(coresPartes[a])
  }
}
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