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

87
Views
Problema con los métodos getvalues en la clase de rango

Estoy tratando de crear un script para verificar si todos los valores en un rango de filas son únicos usando scripts de aplicaciones de Google.

 function verficarCodUnico(){ let ss = SpreadsheetApp.getActive(); let sheet = ss.getActiveSheet(); let lastRow = sheet.getMaxRows(); let frozenRows = sheet.getFrozenRows(); let fCol = sheet.getRange(frozenRows+1,1,lastRow).getValues(); //this range created with to more lines than it should, so: fCol.length = fCol.length -2; let repeated = []; let aux = fCol.filter(function(elemento, i) { if(fCol.indexOf(elemento) !== i) { repeated.push(elemento) } return fCol.indexOf(elemento) == i;

este código debería funcionar, pero la matriz fCol se creó como una matriz de matrices fCol = [[1],[123],[2],[123]] pero lo que quiero es fCol = [1,123,2,123]

Podría solucionar el problema con

 let fCol2 = []; for (i in fCol){fCol2.push(fCol[i][0])}

Busqué en la API de secuencias de comandos de la aplicación de Google y entendí que getValues debería devolver los valores del rango. ¿O estoy equivocado?

imprimir desde la página de ayuda del script de la aplicación de Google

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!