file-saver-angular
TypeScript icon, indicating that this package has built-in type declarations

0.0.6 • Public • Published

Documentation

This library is used to export data to csv/excel

Installation

npm install file-saver-angular

import FileSaverAngularService in your component and add this service in providers

providers: [FileSaverAngularService]

create service object

constructor(private fileSaverServiceObj: FileSaverAngularService) { }

How to export data in csv. use exportToCsv() method using service object like this

this.fileSaverServiceObj.exportToCsv(
      [
        {
          Language: 'Python',
          Framework: 'Django'
        }, {
          Language: 'PHP',
          Framework: 'Laravel'
        }
      ], 'test.csv'
    );

How to export data in excel. use exportToExcel() method using service object like this

this.fileSaverServiceObj.exportToExcel(
      [
        {
          Language: 'Python',
          Framework: 'Django'
        }, {
          Language: 'PHP',
          Framework: 'Laravel'
        }
      ], 'test.xls'
    );
1. first parameter is a data array 
2. second parameter is a file name

Package Sidebar

Install

npm i file-saver-angular

Weekly Downloads

34

Version

0.0.6

License

MIT

Unpacked Size

136 kB

Total Files

26

Last publish

Collaborators

  • codewithashish