Switch branches/tags
Nothing to show
Clone or download
Latest commit 75f63f2 Mar 4, 2017
Permalink
Failed to load latest commit information.
src update Mar 4, 2017
.DS_Store updated package Mar 4, 2017
.gitignore updated package Mar 4, 2017
.npmignore init commit Mar 4, 2017
README.md Update README.md Mar 4, 2017
package.json updated package Mar 4, 2017
tsconfig.json updated package Mar 4, 2017
webpack.config.js update Mar 4, 2017

README.md

export-csv

Blog - article

http://javaee.ch/2017/03/05/angular-and-javascript-export-your-data-to-csv-using-typescript/ Image of export

Example

http://angular.cafe

Goal - Export your web table to Excel in a click

Many js applications show tables and data. Very often the business users need the possibility to export their data in excel. Most of the time a simple export (no server required) is enough.

Description

This package easily export to the CSV the content of an array of objects (JavaScript or JSON, e.g. table of data on the screen) to a format compatible with Excel.

Features

  • The library has been written in Typescript and target Angular (1.x, >=2).
  • It is possible to decide which columns export and in which order.

Installation

npm i @molteni/export-csv --save

or add to your package.json in the 'dependencies' : "@molteni/export-csv": "^0.0.1",

Usage

In Angular import the library with: import ExportToCSV from "@molteni/export-csv";

Use the library:

Export only one specific columns

exportColumnsToCSV(JSONListItemsToPublish : any[], fileName : string, columns : string[]);

var exporter = new ExportToCSV();
exporter.exportColumnsToCSV(this.blogArticles, "filename", ["title"])

Export all the columns

exportAllToCSV(JSONListItemsToPublish : any[], fileName : string);

var exporter = new ExportToCSV();
exporter.exportColumnsToCSV(this.blogArticles, "filename")

Limitations

  • doesn't work with Safari