function getCost(zipCode){
var ss = SpreadsheetApp.openByUrl(url);
var ws = ss.getSheetByName("optionV2");
var data = ws.getRange(1,1,ws.getLastRow(),2).getValues;
// //searching in the zipcodelist
var zipCodeList = data.map(function(r){return r[0];});
var costList = data.map(function(r){return r[1];});
var position = zipCodeList.indexOf(zipCode);
// // check if its greater -1
if(position > -1){
// //return the item on the same position
return costList[position];
}else{
return 'no Recored';
}
}
function getEstimate(){
var zipCode = document.getElementById("zip").value;
google.script.run.getCost(zipCode);
// if(zipCode.length >= 2){
google.script.run.withSuccessHandler(updateEstimate).getCost(zipCode);
// }
}
// //accept whatever the getcost has
function updateEstimate(cost){
//show value on estimate label
document.getElementById("est").value = cost;
M.updateTextFields();
}
....