Small JavaScript Library To Export JSON Data To CSV File – CSV-Export

Category: Javascript | April 8, 2015
Authormikebald
Last UpdateApril 8, 2015
LicenseMIT
Tags
Views16,252 views
Small JavaScript Library To Export JSON Data To CSV File – CSV-Export

CSV-Export is a small and easy-to-use JavaScript library that lets you export JSON data to a CSV file.

See Also:

How to use it:

Download and import the CSVExport.js JS library in your document.

<script src="CSVExport.js"></script>

Prepare your JSON data.

var example = [{Name: "Bob", Age: 22}, {Name: "Frank", Age: 19}, {Name: "Henry", Age: 43}];

Phrase and export the JSON data into CSV.

var x = new CSVExport(example);
return false;

The full markup to phrase the JSON data and download the CSV file through a button.

function exampleA(){
  var example = [{Name: "Bob", Age: 22}, {Name: "Frank", Age: 19}, {Name: "Henry", Age: 43}];
  var x = new CSVExport(example);
  return false;
}
<input type="button" onclick="exampleA();" value="Example A">

You Might Be Interested In:


2 thoughts on “Small JavaScript Library To Export JSON Data To CSV File – CSV-Export

Leave a Reply