I'm using the csvToArray() compact version from this question and answer to write all of the rows as a single array to a range in a spreadsheet:
Access, parse, and write .csv data - google apps script
My issue is that I'm ending up with an empty array for the last "row" in the array after it has parsed my data, and it's causing an error to throw on the setValues line:
sheet.getRange(1,1,arrData.length,arrData[0].length).setValues(arrData);`
The error I am getting is "Incorrect Range size, was 1, but should be 4. I've narrowed it down to the last "row" by looking at the debugger, which shows the last array in the set with as [""].
I've tried to parse arrData with:
for (row in arrData){if(arrData[row] !=""){return(arrData[row])}}
And other similar methods (for if, while, etc), but can't quite figure out how to stop adding values to arrData if the row is blank.
Any suggestions?