Installation
Clone or download the Github repo or via npm:
npm install xlsexport
Usage
xlsExport is defined as a class, and has to be instantiated with data (objects array) and an optional title.
var xls = new XlsExport([..., Object], String);
Since Chromium(v61) supports ES6 Modules, XlsExport is available with 'import' syntax . For older browsers I also include an ES5 version inside the package.Methods
- exportToXLS(String fileName): convert data and force download of a Excel XLS file.
- exportToCSV(String fileName): convert data separate by semi-colons and force download of a CSV file.
Example
import XlsExport from './xls-export.js';
var xls = new XlsExport([..., Object], String);
xls.exportToXLS('export2017.xls');
xls.exportToCSV('export2017.xls');
var xls = new XlsExport([..., Object], String);
xls.exportToXLS('export2017.xls');
xls.exportToCSV('export2017.xls');