jueves, 19 de enero de 2023

Create Web App Form on Google Sheets using Google Apps Script

 



https://www.youtube.com/watch?v=qdu1tPDca5c




ccpassword
1231144
4561534
7891480
9871997
6542000
1234565689



code.gs
function doGet(e) {
  return HtmlService.createHtmlOutputFromFile('WebApp_G5');
}

function AddRecord(ccpassword) {
  var url = 'https://docs.google.com/spreadsheets/d/1Cg5-FM1Phr-wq4Pb5hqcq8XVb_FOJlbQfB100PpVaAU/edit#gid=0';
  var ssSpreadsheetApp.openByUrl(url);
  var webAppSheet = ss.getSheetByName("Usuarios");
  webAppSheet.appendRow([ccpasswordnew Date()]);
  
}


WebApp_G5.html
<!DOCTYPE html>
<html>
  <head>
    <base target="_top">
    <script>
    function AddRow()
    {
      var cc = document.getElementById("cc").value;
      var password = document.getElementById("password").value;
      google.script.run.AddRecord(ccpassword);
      document.getElementById("cc").value = '';
      document.getElementById("password").value = '';
    }
    </script>    
  </head>
  <body>
    cc:<input type="text" id="cc" />
    password:<input type="text" id="password" />
    <input type="button" value="Add" onclick="AddRow()" />   
  </body>
</html>

No hay comentarios:

Publicar un comentario