Go to: Demo | Documentation
String.split(',')
and let Papa show you how it's done.Papa is a powerful jQuery plugin that parses CSV (delimited text) input and can handle large files by streaming them.
Turn CSV text into arrays or objects with one line of code.
Papa's good at guessing delimiters and dealing with large files, even multiple files at once.
$('input[type=file]').parse({
complete: function(data) {
console.log("Parse results:", data.results);
}
});
Alleviate privacy concerns and waiting on uploads. Your users would be very happy to know their files don't have to leave their computers.
Try some of these inputs or use your own to see what Papa can do.
Text: Basic Header Row Numbers Malformed
Files: Basic Header Row Numbers Malformed Big
Papa knows lots of useful tricks.
Not sure what you're up against? Papa can figure out the delimiting character for you if you don't specify one.
Papa can attach to <input type="file">
elements so you can parse them without uploading them to your server or worrying about FileReader boilerplate. Tada!
Malformed input is robustly recovered where possible, and errors are grouped by row. Papa never serves up results without an error report.
For inputs with a header row, Papa can key values by their field names instead of meaningless index numbers. You'd only notice a performance hit with very large inputs.
For large files, stream the parse results to your own callback function, one row at a time. This greatly reduces memory usage. You still get a report of the errors.
By default, each value is returned as a string. But Papa can turn numeric data points into numbers. It comes at a slight performance hit, but you'd only notice on large inputs.
<script src="jquery.papaparse.min.js"></script>