I am using this javascript parser for tab separated CSV: var curData = parse(curContents, false); function parse( curContents, option) { try { // output object var data = {}, // output no columns array container = [], // output array records = [], // splits csv data at each new line lines =input.split(/\r/), // creates columns by splitting first line of csv columns = lines[0].split('\t'); // creates objects from csv data if column option included if (option === true) { // loop through each line of csv file for (var l = 1; l <= lines.length-1; l++) { // splits each line of csv by comma var words = lines .split('\t'); // builds object based on column headers for (var cell in columns) { data[ columns[cell] ] = words[cell]; } // pushes object to output array records.push(data); // resets object in order to add another data = {}; } } else { // creates nested arrays from csv data if column option omitted, false or not true for (var l = 0; l <= lines.length-1; l++) { var curLine = lines ; // leere Zeilen ignorieren if (curLine == "\t") continue; // splits each line of csv by comma var words = curLine.split('\t'); // creates objects from csv data for (var cell in words) { container.push(words[cell]); } // push array to output array records.push(container); // reset array in order to add another container = []; } } // returns output array return records; } catch(error){ return err; } }
... View more