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

246
Visualizações
I want to display google script single cell value in html text box on button event

I am totally new and try to learn the script...pls someone help to resolve this issue

simply i wanna to get google script cell value and show to this in text box

GS code

function doGet(e) {
  return HtmlService.createHtmlOutputFromFile('WebAppSecure');
  htmlOutput.message = '';
   return htmlOutput.evaluate();
  }

function getValues(){
  var url = "url link";
  var ss = SpreadsheetApp.openByUrl(url);
  var webAppSheet = ss.getSheetByName("Sheet4");
  var getRange=webAppSheet.getRange(2,1).getValues();
  console.log(getRange);//output value :23:43 PM    Info    Sunil
}

html side

function getresult(){
  google.script.run.withSuccessHandler(function(output) {
   var iterm=document.getElementById("dname").value;
 }).getValues(name);
 console.log(name);
}


 <input type="text" id="dsrn" />
 <input type="button" id="button2" value="ID_Search1" onclick="getresult()"/>
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I don't wish to create a doGet() so here's the same thing done with a dialog:

GS:

function launchMyDialog() {
  SpreadsheetApp.getUi().showModelessDialog(HtmlService.createHtmlOutputFromFile('ah1'),'Dialog Title');
}

function getMyValue() {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Sheet0');
  return sh.getRange(2,1).getValue();
}

html:

<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
  </head>
  <body>
  <input type="text" id="txt"/>
  <br /><input type="button" value="Get Data" onClick="getValue();" />
  <script>
    function getValue() {
      google.script.run
      .withSuccessHandler((v) => {document.getElementById("txt").value = v;})
      .getMyValue();
    }
    console.log("my code")
  </script>
  </body>
</html>

enter image description here

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