I have a script in which the row data of a google sheet is stored into a JSON. I'd like to filter the data that is stored in the array.I don't want the empty cells to be inserted into the array. I want only the filled cells to be inserted into the array .Here is the script I'm using
var dataArray = [];
var rows = sheet.getRange(2,1,sheet.getLastRow()-1, sheet.getLastColumn()).getValues();
for(var i = 0, l= rows.length; i<l ; i++){
var dataRow = rows[i];
var record = {};
record['name'] = dataRow[0];
record['age'] = dataRow[1];
record['weight'] = dataRow[2];
dataArray.push(record);
}