Working with CSV in jquery Papa parse | Ram Laxman Yadav

Working with CSV in jquery Papa parse

Papa Parse is a powerful CSV (delimited text) parser that gracefully handles large files.you can easily use this and can parse large csv files efficiently.you can get papa parse here[https://github.com/mholt/PapaParse].

here is short example of using Papa Parse:

1. Converts csv to json:

var result = Papa.parse(csv_file)

2. Parse local CSV files:

 $('input[type=file]').parse({
config: {
             complete: function(results) {
                  console.log("Parse results:", results.data);
                 }
             }
           });
           

3. Parse remote CSV files:

follow these steps to add a new user in sudo group:

Papa.parse("http://example.com/file_name.csv", {
        download: true,
        complete: function(results) {
                         console.log("Remote file parsed!", results);
                       }
       }); 

4. Get data keyed by field name:

var results = Papa.parse(csv, {
                          header: true
                          });         
  
Thanks for reading this blog post!!

Ram Laxman Yadav
Ram Laxman Yadav
Ruby on Rails Developer