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

125
Visualizações
I'm trying to store an element from the users input but I cant

I'm trying to store an element from the users input which is called wn but its not being stored and when I logger.log(wn) im just keep getting the array (all the numbers, from 348-372)

I used wn.getEllemntById(input); but its not working (I'm sure it has something to do with the scope or something but i just don't know how to fix it).

I also don't know how to stop the program and make it continue when the user selects a weak and click confirm.

*I'm using java Script in google app script

*I'm getting the users input from an excel sheet

function menu(){
        //get the good week number
        var date = new Date();
        var wn = [(Math.floor(WEEKNUMBER(date))+3).toFixed(0)]
        do {  
            wn.push((wn[wn.length-1]-1).toFixed(0))
        } while(wn[wn.length-1] != 348);
        var line = "<select style='width:60px;height:40px;' id='input'>"
        for ( var x in wn ) // thats the loop taht is going to show all the weeks for the user
          line +="<option>" + wn[x] + "</option>"
        line +="</select>"
        Logger.log(wn);
        var ui = SpreadsheetApp.getUi();
        var html = HtmlService.createHtmlOutputFromFile('Selector')
            .setWidth(200)
            .setHeight(150).setContent("<div>"+line + "</div><br>.  <div><button onclick='reset()'>Confirm</button> </div>.  <script>function  reset(){var wn = document.getElementById('input').value;document.getElementsByTagName('Body')[0].style.cursor = 'wait';google.script.run.withSuccessHandler(function (){google.script.host.close();}).readWP2(wn); Logger.log(wn);}</script>")
        SpreadsheetApp.getUi() // Or DocumentApp or SlidesApp or FormApp.
            .showModalDialog(html, 'Please select a week number');
Logger.log(wn);
}

Summary: I want to stop the program and make it continue when the user selects a weak and click confirm. + How to store the week number the user selects in a variable.

Please let me know if you need any more explanation

Thank you

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

0

I believe that you just need this function:

gs:

function readWP2(wn) {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Sheet1');
  sh.getRange("A1").setValue(wn);
}
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