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

555
Vistas
Google Apps Script: How to find column number of specific value in array?

What I'm trying to achieve is to get the column number of a specific cell. If the cell value in the array equals to the value of today's date, then give back the column number of that cell.

dateArrayD = 1 row containing all the dates from January 1 to December 31, formatted

dateTodayD = the date today, formatted

So if dateTodayD equals dateArrayD, then dateCol would be the column number. I simply can't find a solution for this.

for(var z = 0; z < dateArrayD.length; z++){
    if(dateTodayD !== dateArrayD[0][z]){
      var dateCol = z;
    } // end if
  } // for end
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This function adds a line feed and row , column to each cell.

function calcRowColumn() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Sheet0');
  const sr = 4;//data start row
  const sc = 4;//data start column
  const rg = sh.getRange(sr,sc,sh.getLastRow() - sr + 1, sh.getLastColumn() - sc + 1);
  const vs = rg.getDisplayValues();
  vs.forEach((r,i) => {
    let row = i + sr;
    r.forEach((c,j) => {
      let col = j + sc;
      vs[i][j] += `\n${row},${col}`;
      
    })
  })
  rg.setValues(vs);
}

Start Data:

enter image description here

End Data:

enter image description here

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