Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

244
Vistas
How can i create login form that uses data from google sheet database?

I have created a registration form that stores user data in google sheet and i want to create a login form that uses stored data for validation to be redirected to another page.How can i do so?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Make a backend API, using something like Express NodeJS. This backend will use the Google Sheets API to parse data from the spreadsheet.

When the front end signs in, send a request to backend, something that looks like, here's my username and password. Then, when the backend receives this request, the backend will check with the parsed google sheets data to see if the credentials are correct. If it is, then redirect them or do whatever you want.

The point of having a backend (a separate, hosted, server) as an extra step, is that this hides the spreadsheet containing all the info from the front end user. Only the server is able to see the info contained in the spreadsheet, and decide if the user's credentials are correct.

about 4 years ago · Juan Pablo Isaza Denunciar

0

A Login Form

google script:

function login(obj) {
  const ss = SpreadsheetApp.getActive();
  const sh = ss.getSheetByName('Login');
  const vs = sh.getRange(2,1,sh.getLastRow() - 1, 2).getValues();
  let robj = {loggedin:false};
  for(let i = 0;i<vs.length; i++) {
    if(vs[i][0] == obj.userid && vs[i][1] == obj.password) {
      robj.loggedin = true;
      break;
    }
  }
  return robj;
}

function launchLogin() {
  const ui = SpreadsheetApp.getUi();
  ui.showModelessDialog(HtmlService.createHtmlOutputFromFile("ah1"),"Login Form");
}

html:

<!DOCTYPE html>
<html>

<head>
</head>

<body>
  <div id="content"></div>
  <form>
    <input type="text" placeholder="UserId" name="userid" />
    <br /><input type="text" placeholder="password" name="password" />
    <br /><input type="button" value="Login" onClick="login(this.parentNode);" />
  </form>
  <div id="msg"></div>
  <script>
    function login(obj) {
        google.script.run
        .withSuccessHandler((obj) => {
          (obj.loggedin == true) ? document.getElementById('msg').innerHTML = "Your are logged in" : document.getElementById('msg').innerHTML = "Go away";
        }).login(obj);
      }
    console.log("My Code");
  </script>
</body>

</html>

Login Form Dialog:

enter image description here

Login Sheet:

userid password
boo hoo
me you
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda