I have a spreadsheet which I have more than 1000 lines, each column is a field, one of the columns has the field called Domain, "which will be the value I need to query", my application using HTML will need to query using a Text box the HTML to a function, to search the Spreadsheet and return the values of the same line in the HTML.
Now here is the HTML Code:
<html>
<head>
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/0.10.0/angular-material.min.css">
<link rel="stylesheet" href="https://storage.googleapis.com/code.getmdl.io/1.0.0/material.blue-green.min.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-sanitize.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-animate.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-aria.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-messages.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angular_material/0.10.0/angular-material.min.js"></script>
<script src="https://storage.googleapis.com/code.getmdl.io/1.0.0/material.min.js"></script>
<?!= include('WebPage.js'); ?>
<?!= include('Style'); ?>
</head>
<body ng-app="webApp">
<div ng-controller="webAppCtrl">
<div>
<md-toolbar class="md-theme-light">
<div class="md-toolbar-tools">
<div>DeLight App</div>
</div>
</md-toolbar>
<div id="body">
<div layout="row" layout-align="center start" layout-margin layout-fill layout-padding>
<div>
<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="sample3" />
<label class="mdl-textfield__label" for="sample3">Enter Domain</label>
</div>
</form>
</div>
</div>
<div layout="row" layout-align="center start" layout-margin layout-fill layout-padding>
<div id="leftContainer" class="md-whiteframe-z2" flex="50">
<md-toolbar class="md-theme-light">
<div class="md-toolbar-tools">
<div>Customer Info</div>
</div>
</md-toolbar>
Pull Customer Info here from Sheet
</div>
<div id= "rightContainer" class="md-whiteframe-z2" flex="50">
<md-toolbar class="md-theme-light">
<div class="md-toolbar-tools">
<div>Task List</div>
</div>
</md-toolbar>
<md-list-item>
<p>Verified Domain Owner</p>
<md-checkbox class="md-secondary"></md-checkbox>
</md-list-item>
<md-list-item>
<p>User Creation</p>
<md-checkbox class="md-secondary"></md-checkbox>
</md-list-item>
<md-list-item>
<p>Dual Delivery</p>
<md-checkbox class="md-secondary"></md-checkbox>
</md-list-item>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Here is the Web App Function Scripts page:
function doGet(e) {
return HtmlService.createTemplateFromFile('Index').evaluate()
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.setTitle('Test')
}
function include(filename) {
return HtmlService.createHtmlOutputFromFile(filename)
.setSandboxMode(HtmlService.SandboxMode.IFRAME)
.getContent();
}
function testSheet(){
var ss = SpreadsheetApp.openById("abc123456");
Logger.log(ss.getName());
}
The problem that I have is that I don't know how I can store the information that the user submits to the Textbox so I can later search my spreadsheet using a snippet I found here which is:
function test(){
var sh = SpreadsheetApp.openById("abc123456");
var data = sh.getDataRange().getValues(); // read all data in the sheet
for(n=0;n<data.length;++n){ // iterate row by row and examine data in column A
if(data[n][0].toString().match('searchvariable')=='searchvariable'){ data[n][5] = 'YES'};// if column A contains 'xyz' then set value in index [5] (is column F)
}
Logger.log(data)
sh.getRange(1,1,data.length,data[0].length).setValues(data); // write back to the sheet
}
Any Ideas how can I achieve this?
Thank you