Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda