Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!