node-xml-xlsx
📋 XLSX file generator for NodeJS
Installation
npm i node-xml-xlsx
Usage
const fs = ;const Xlsx = ; const xlsx = ;const xlsxFileStream = xlsx; // Pipe xlsx file to a writeable streamxlsxFileStream; // Append rows to the Xlsx filexlsx; xlsx; // Invoke build to finalize workbook writtingxlsx;
API
Xlsx
Creates an instance of Xlsx
object in order to write a new XLSX workbook.
const Xlsx = ; const xlsx = ;
Xlsx.getStream(): Archiver
node-xml-xlsx
uses Archiver internally to create a zip file.
An xlsx file is basically a zip file with an specific structure based on xml files.
Returns an Archiver instance that can be used to pipe the file contents to a writeable stream while writting the xlsx file.
const fs = ;const Xlsx = ; const xlsx = ;const xlsxFileStream = xlsx; xlsxFileStream;
Xlsx.addRow(values: XLSXValue[]): void
Appends a new row to the xlsx file based on the array values. Each element of the array represents a column of the xlsx file.
// Append rows to the Xlsx filexlsx; xlsx;
Xlsx.build(): Promise
Finalizes writting process and write footters to the zip file.
// Invoke build to finish workbook writtingxlsx;
Sheet
A Sheet
implements the capabilities of an xlsx file's sheet.
Sheet's API is exported but its usage is internal, in the current version
node-xml-xlsx
is capable of creating single sheet workbooks only.
Sheet - XLSXValue
Sheet
's type XLSXValue
enumerates available types to be written in
a sheet.
The current types are:
- String
- Number
Support for more types could be added further based on Issues/Requests.
Contributions
Any contribution is welcome, feel free to open either a pull request or issue (also both), and remember to write out your name, email and website in the Authors file.
License
Licensed under the MIT License