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

100
Visualizações
Issue using setValues to append and fill a column in sheets with an array passed via a function

Here's the scenario: On clicking a button, 11 pieces of user data are taken from a web form and inserted into the userInfo array in function doStuff. I then attempt to pass userInfo to userClicked to append a column into a googlesheet with the new user data. My lack of understanding on how to construct, pass and present array data is my issue here I think and a couple of online tutorials have not really helped me. Thanks for advice/answers.

function doStuff(){
    
    var userInfo ={};
    
    userInfo.username = document.getElementById("username").value;
    userInfo.teamname = document.getElementById("teamname").value;
    userInfo.email = document.getElementById("email").value;
    userInfo.m_p1 = document.getElementById("m_p1").value;
    userInfo.m_p2 = document.getElementById("m_p2").value;
    userInfo.m_p3 = document.getElementById("m_p3").value;
    userInfo.m_p4 = document.getElementById("m_p4").value;
    userInfo.m_p5 = document.getElementById("m_p5").value;
    userInfo.m_p6 = document.getElementById("m_p6").value;
    userInfo.m_p7 = document.getElementById("m_p7").value;
    userInfo.m_p8 = document.getElementById("m_p8").value;
    

    google.script.run.userClicked(userInfo);
{

function userClicked(userInfo){
  var ss = SpreadsheetApp.openByUrl(url);
  var ws = ss.getSheetByName("UserData");

  ws.insertColumnAfter(ws.getMaxColumns());
  ws.getRange(1,ws.getLastColumn()+1,12,1).setValues(userInfo);
}

The userInfo array looks as follows from the log: [{m_p2=Choose Player 2, m_p6=Choose Player 6, m_p8=Choose Player 8, m_p1=6 R Nadal, m_p3=Choose Player 3, email=, username=, m_p5=Choose Player 5, m_p4=Choose Player 4, m_p7=Choose Player 7, teamname=}]

about 4 years ago · Juan Pablo Isaza
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