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?