Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

export.js

export.js is a JavaScript utility that help transfer and download data to CSV format, other formats could be added in future releases.

#Demo Live demo
export.js with Highchart

exportToCsv(data, keys)

This function exports to csv, formatted vertically to ease importing it to spreadsheet applications.

It expect two parameter the first is array of string arrays, example:

    var data = [ ["USA","France"], ["Washington DC", "Paris"] ] ; 

The second is array of strings that is associated with the data, example:

    var keys = ["Country","Capital"]; 

Calling exportToCsv(data, keys) will create a csv that looks like this:

Country,Capital
USA,Washington DC
France,Paris

if you import this csv to spreadsheet application, the data will look like this:

Country Capital
USA Washington DC
France Paris

#Browser support if you are using Chrome or Firefox the browser will download it as text file, if you are using IE a new window will pop up and then you could copy and paste the text or you could right click and choose save to a file.

About

Utility to export CSV from javascript.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors