https://www.youtube.com/watch?v=qdu1tPDca5c
code.gs
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('WebApp_G5');
}
function AddRecord(cc, password) {
var url = 'https://docs.google.com/spreadsheets/d/1Cg5-FM1Phr-wq4Pb5hqcq8XVb_FOJlbQfB100PpVaAU/edit#gid=0';
var ss= SpreadsheetApp.openByUrl(url);
var webAppSheet = ss.getSheetByName("Usuarios");
webAppSheet.appendRow([cc, password, new 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(cc, password);
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