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

337
Visualizações
AppScript Array Filter (String) not filtering empty values

Trying to filter out empty values from getRange values but still giving me all data. I've tried the following but still not what I expected.

Data array logs the following: 123,,,444,,,331,323,,,,,,5443

var list = source.getRange("sheet!A1:J1:).getValues().filter(String);

or using callback function

list.filter(function(f) {return f[0] !=='';})

Result is still the same 123,,,444,,,331,323,,,,,,5443 What did I missed here?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

After your comment i am not sure if the data you get is an array or an string:

Data array logs the following: 123,,,444,,,331,323,,,,,,5443

For the array case: [123,,,444,,,331,323,,,,,,5443]

const list = [123,,,444,,,331,323,,,,,,5443]
const result = list.filter(Boolean)

console.log(result)

For the string case: 123,,,444,,,331,323,,,,,,5443

const list = '123,,,444,,,331,323,,,,,,5443'
const result = list.split(',').filter(Boolean).map(Number)

console.log(result)

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