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

201
Vistas
Google sheets API fetch the value of Merged cells

I am using Google Sheets API to display the data from my Google Spreadsheet in my javascript application. Have developed by refering this documentation. I could able to read the values from my spreadsheet but for some of the columns the cells are merged as below.

enter image description here

I am getting the Json response as

[
[
  "Name",
  "Age"
 ],
[
  "John",
  "25"
 ],
[
  "Doe"
 
 ],
]

My expected output should be

   [
[
  "Name",
  "Age"
 ],
[
  "John",
  "25"
 ],
[
  "Doe",
   "25"
 
 ],
]

Any help ?

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

0

To retrieve the value, you have to test if the cell is part of a merged area.

var value = (cell.isPartOfMerge() ? cell.getMergedRanges()[0].getCell(1,1) : cell).getValue();
about 4 years ago · Juan Pablo Isaza Denunciar

0

Modify the script as following

    appendPre('Name, Major:');
    var lastData=''
    for (i = 0; i < range.values.length; i++) {
      var row = range.values[i];
      if (row[4]!=''){lastData=row[4]}
      // Print columns A and lastData, which correspond to indices 0 and the last known value in column E that contains merged cells.
      appendPre(row[0] + ', ' + lastData);
    }

so that you will recall the last value if the cell is empty

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