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

Category: Javascript | April 8, 2015
Author: mikebald
Views Total: 8,103
Official Page: Go to website
Last Update: April 8, 2015
License: MIT

Preview:

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

Description:

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

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