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

107
Visualizações
How to modify the rows of a DataTable using the array values in google apps script?
  function drawChart() {
        var data = new google.visualization.DataTable();
        
        data.addColumn('string', 'From');
        data.addColumn('string', 'To');
        data.addColumn('number', 'number of calls');
        data.addRows([
          [ 'calls', 'X', 5 ],
          [ 'calls', 'A', 7 ],
          [ 'calls', 'B', 6 ],
          [ 'calls', 'C', 2 ],
          [ 'calls', 'D', 9 ],
          [ 'calls', 'E', 4 ]
        ]);

The above is just a portion of an HTML code that I would like to modify the data.addRows([]) by using the array values. It seems not practical to hardcode the rows, so I believe there is a simple workaround for this. For example I have a range values in google sheet, var values=Spreadsheet.getActive().getSheetByName('sheet1').getRange("A1:C6"). I tried to use data.addRows(values) but its not working. I am new to apps script coding and I don't know where to insert my code var values=Spreadsheet.getActive().getSheetByName('sheet1').getRange("A1:D5") to be usable in that HTML code above dataTable. Please help.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Try using:

var values=Spreadsheet.getActive().getSheetByName('sheet1').getRange("A1:D5").getValues();

data.addRows(values);
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