Papaparse is parsing numbers that are not there

670 views Asked by At

I'm combining 2 csv spreadsheets into 1. Fist sheet/half has a certain format (let's say- round number, decimals, percentage, round number), and 2nd part/half has a different format (let's say decimals, currency, round number, round number). I insert contains of 2nd sheet right under the first one, make sure there is equal amount of columns and parse it. First half gets all the numbers right. When it gets to 2nd half, 80% of numbers are different (usually, smaller than the actual ones in the spreadsheet).

Not sure if it has something to do with formating of it or something else.

JS is pretty standard

 function arrayToTable(tableData) {
    var table = $('<table></table>');
    $(tableData).each(function (i, rowData) {
        var row = $('<tr></tr>');
        $(rowData).each(function (j, cellData) {
            row.append($('<td>'+cellData+'</td>'));
        });
        table.append(row);
    });
    return table;
}

$.ajax({
    type: "GET",
    url: "data/late2.csv",
    success: function (data) {
        $('body .tableclass').append(arrayToTable(Papa.parse(data).data));
     }
   });
0

There are 0 answers