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
Printing Array Values on Apps Script

How do you print all values in an array onto the modal dialog? I have tried the code below but it only prints the last array value.

for (var count = 0; count < 10; count++) {
  var htmlOutput = HtmlService.createHtmlOutput(arr[count]);
  var arrayOutput = SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'Test');
}
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can just use join method

SpreadsheetApp.getUi().showModalDialog(HtmlService.createHtmlOutput(arr.join(","),"Test")

or

SpreadsheetApp.getUi().showModalDialog(HtmlService.createHtmlOutput(JSON.stringify(arr),"Test")
about 4 years ago · Juan Pablo Isaza Denunciar

0

showModalDialog() method does not suspend the server-side script while the dialog is open.

The script should show all the elements one by one. But a newer dialog might close the older one. So, you probably only see the last one. If you want to show all the elements in one dialog, use JSON.stringify():

SpreadsheetApp.getUi().showModalDialog(
  HtmlService.createHtmlOutput(
    JSON.stringify(arr,null,2)
  ), 'Test'
);

Or if you want to see them one by one, use Utilities.sleep():

for (var count = 0; count < 10; count++) {
  var htmlOutput = HtmlService.createHtmlOutput(arr[count]);
  var arrayOutput = SpreadsheetApp.getUi().showModalDialog(htmlOutput, 'Test');
  Utilities.sleep(15*1000);
}
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