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()"/>
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>