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?
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)