Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

237
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda