Quantcast
Channel: Hot Weekly Questions - Web Applications Stack Exchange
Viewing all articles
Browse latest Browse all 9843

I am trying to create a data entry using google apps scripts whihc should add user input to the sheet

$
0
0

here are the two files that i am using userform.html

<!--Let browser know website is optimized for mobile-->
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>

<body>

<div class="container">

     <div class="row">
        <div class="input-field col s12">
          <i class="material-icons prefix">account_circle</i>
          <input id="techname" type="text" class="validate">
          <label for="techname">Tech Name</label>
        </div>
        <div class="input-field col s12">
          <i class="material-icons prefix">phone</i>
          <input id="tel" type="text" class="validate">
          <label for="tel">Telephone</label>
        </div>

        <div class="input-field col s12">
            <button class="btn waves-effect waves-light" id= "btn">Add
              <i class="material-icons right">send</i>
            </button>
        </div>            

      </div><!-- End Row-->


</div>

    <!-- Compiled and minified JavaScript -->
    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
    <script>
      var TechName = document.getElementById("techname");
      var Phone = document.getElementById("tel");

    document.getElementById("btn").addEventListener("click",addRecord);
    fucntion addRecord(){

         var TechNameData = TechName.value;
         var PhoneData=  Phone.value;

       google.script.run.appendData(TechNameData,PhoneData);
       Logger.log(TechNameData);

    }

    </script>


</body>

code.gs

    function showUserForm(){
var template = HtmlService.createTemplateFromFile("userform");
var html = template.evaluate();
html.setTitle("Data Entry");
SpreadsheetApp.getUi().showSidebar(html);

}

function appendData(TechNameData,PhoneData){

var ws = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Data_Entry");
ws.appendRow([TechNameData,PhoneData]);

}

Viewing all articles
Browse latest Browse all 9843

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>