Skip to content

KedneckInc/ember-cli-data-export

 
 

Repository files navigation

ember-cli-data-export

Addon that encapsulates ability to render a data set as either excel or csv.

Installation

  • ember install ember-cli-data-export

Usage

  • uses js-xlsx library for rendering excel content.
  • automatically injects a service for both excel and csv format
  • feed a datastructure that's an array of arrays, where each internal array is the set of data to be rendered for that row.
  • Example: [['Title 1', 'Title 2', 'Title 3'],['row1cell1', 'row1cell2', 'row1cell3'],['row2cell1', 'row2cell2', 'row2cell3']]

Example

   var data = [
       ['Title 1', 'Title 2', 'Title 3'],
       ['row1cell1', 'row1cell2', 'row1cell3'],
       ['row2cell1', 'row2cell2', 'row2cell3']
   ];

   if (type === 'Excel') {
     this.get('excel').export(data, 'sheet1', 'test.xlsx');
   } else if (type === 'CSV') {
     this.get('csv').export(data, 'test.csv');
   }

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 82.7%
  • HTML 17.3%