Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
HTML
<script src=”//code.jquery.com/jquery-1.10.2.js”></script>
<link rel= “stylesheet” href= https://ssl.gstatic.com/docs/script/css/add-ons.css”>
<script>
Function procesaFormulario (){
Google.script.run.procesaFormDatosPersona(document.forms[0]:
}
Function buscaInformacion (){
google.script.run.withSuccessHandler(getNombres).getNombresSS(document.forms[0]);
google.script.run.withSuccessHandler(getApellidos).getApellidosSS(document.forms[0]);
google.script.run.withSuccessHandler(getSexo).getSexoSS(document.forms[0]);
google.script.run.withSuccessHandler(getDireccion).getDireccionSS(document.forms[0]);
google.script.run.withSuccessHandler(getCelular).getCelularSS(document.forms[0]);
}
Function editaInformacion (){
google.script.run.setNombresSS(document.forms[0]);
google.script.run.setApellidosSS(document.forms[0]);
google.script.run.setSexoSS(document.forms[0]);
google.script.run.setDireccionSS(document.forms[0]);
google.script.run.setCelularSS(document.forms[0]);
}
function getNombres(nombres){
var =document.getElementById(‘nombres’);
txtNombres.value=nombres;
}
function getApellidos(apellidos){
$(“#apellidos”).val(apellidos);
}
function getSexo(sexo){
$(“#sexo”).val(sexo).change();
}
function getDireccion(direccion){
$(“#direccion”).val(direccion);
}
function getCelular(celular){
$(“#celular”).val(celular);
}
$(function(){
$(“#guardar”).click(procesaFormulario);
$(“#buscar”).click(buscaInformacion);
$(“#editar”).click(editaInformacion);
});
</script>
<html>
<? var
hojaCalculo=SpreadsheetApp.openById( “https://docs.google.com/spreadsheets/d/1vew9EOnb2vmaf2JYLItNn98r4I
EK3dd9MLS0v9j-XvU/edit#gid=0”);
var hojaParametros=hojaCalculo.getSheetByName(‘Parametros’);
var ultimaFila=hojaParametros.getLastRow();
¿>
<div>
<form id= “datospersona” name= “datosPersona”>
<br>
Nombre (s):
<br><input type= “text” id= “nombre” name= “nombre” placeholder= “Primer y/o Segundo nombre” required>
<br>
Apellido (s):
<br><input type= “text” id= “apellido” name= “apellido” placeholder= “Primer y/o Segundo apellido” required>
<br>
ID:
<br><input type= “text” id= “id” name= “id” placeholder= “Numeros y Letras” required>
<br>
Sexo:
<br>
<select id= “sexo” name= “sexo” required>
<? i=2;
while (i<=ultimaFila){
?>
</select>
<br>
Direccion:
<br><input type= “text” id= “direccion” name= “direccion” placeholder= “Direccion Residencia” required>
<br>
Celular:
<br><input type= “text” id= “celular” name= “celular” placeholder= “Numero de movil” required>
<br><br>
</form>
</div>
</html>
CODIGO DE MAIN.GS
If (le.parameter.page) {
//Cuando no se especifica una página, retorna “Página de inicio”
return HtmlService.createTemplateFromFile( “Index”).evaluate();
}
//***************Función que busca en la Sheet (Como BD) y retorna valor fila *******************
function buscaReturnRow(sId) {
var hojaCalculo =
SpreatsheetApp.openById( “https://docs.google.com/spreadsheets/d/1vew9EOnb2vmaf2JYLItNn98r4IEK3dd9MLS0
v9j-XvU/edit#gid=0”)
var hojaDatos = hojaCalculo.getSheetByName( “Datos”);
//******Función que busca en la Sheet (Como BD) y retorna la información en una fila y columna específica******
var hojaCalculo =
SpreatsheetApp.openById( “https://docs.google.com/spreadsheets/d/1vew9EOnb2vmaf2JYLItNn98r4IEK3dd9MLS0
v9j-XvU/edit#gid=0”)
var hojaDatos = hojaCalculo.getSheetByName( “Datos”);
var sNombre=e.nombre;
var sApellido=e.apellido;
var sId=e.id;
var sSexo=e.sexo;
var sDireccion=e.direccion;
var sCelular=e.celular;
var hojaCalculo =
SpreatsheetApp.openById( “https://docs.google.com/spreadsheets/d/1vew9EOnb2vmaf2JYLItNn98r4IEK3dd9MLS0
v9j-XvU/edit#gid=0”)
var hojaDatos = hojaCalculo.getSheetByName( “Datos”);
var ultimaFila=hojaDatos.getLastRow;
hojaDatos.getRange(ultimaFila+1,1).setValue(sNombre);
hojaDatos.getRange(ultimaFila+1,2).setValue(sApellido);
hojaDatos.getRange(ultimaFila+1,3).setValue(sId);
hojaDatos.getRange(ultimaFila+1,4).setValue(sSexo);
hojaDatos.getRange(ultimaFila+1,5).setValue(sDireccion);
hojaDatos.getRange(ultimaFila+1,6).setValue(sCelular);