Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

221
Views
¿Cómo puedo verificar si una entrada ya existe antes de que sea capturada?

Me gustaría validar una entrada antes de que se agregue como registro al verificar la identificación del estudiante en "UserForm" contra una matriz en "SDB" y si encuentra una coincidencia que aparezca con un error. Por el momento, puedo agregar al mismo estudiante varias veces, lo que me gustaría evitar.

 function validateEntry() { var myGooglSheet= SpreadsheetApp.getActiveSpreadsheet(); var shUserForm = myGooglSheet.getSheetByName("User Form"); var datasheet = myGooglSheet.getSheetByName("SDB"); var ui = SpreadsheetApp.getUi(); //Validating Student Id if(shUserForm.getRange("S1") = SDB.getRange(A:A)) { ui.alert("Already Exists."); shUserForm.getRange("S1").activate(); shUserForm.getRange("S1").setBackground('#FF0000'); return false; } return true; }

¡Cualquier ayuda sería genial!

Editar: Encontré una solución al verificar si la entrada existe en las hojas de cálculo de Google con una fórmula;

 =IFERROR(if(vlookup(S1,SDB!A:A,1,false)=vlookup(S1,SDB!A:A,1,false),"Modify",""),"NEW")

y luego ejecutar el script para verificar la fórmula

 //Validating Student Id if(shUserForm.getRange("O1").getValue()=="Modify") { ui.alert("Entry Already Exists."); shUserForm.getRange("O1").activate(); shUserForm.getRange("O1").setBackground('#FF0000'); return false; }

Hace el truco, ¡pero aún así un método de un solo paso sería ideal!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!