Export JavaScript Array To XLS And CSV – xlsexport

Category: Javascript | October 18, 2021
Author:deblanco
Views Total:5,698 views
Official Page:Go to website
Last Update:October 18, 2021
License:MIT

Preview:

Export JavaScript Array To XLS And CSV – xlsexport

Description:

xlsexport.js is a small, zero-dependency library which allows exporting JavaScript array (containing any number of objects) to Excel files (XLS and CSV).

Installation:

# NPM
$ npm install xlsexport --save

How to use it:

Include the following JavaScript ‘xls-export.js’ onto your html page:

<script src="xls-export.js"></script>

Initialize the xlsexport and pass the following parameters to the ‘xlsExport’ object.

  • data: JS object arrays;
  • title: title (optional);
const xls = new xlsExport(data, title);

Export the JS object arrays to XLS:

xls.exportToXLS('export.xls')

Export the JS object arrays to CSV:

xls.exportToCSV()

Enable RTL mode. Default: false.

xls.exportToXLS('export.xls', true)

Changelog:

10/18/2021

  • Add option to excel worksheet to be from right to left (important for Hebrew and Arabic users)
  • Fix a bug – where data was a number cell with a value of zero it was converted to an empty cell

10/05/2018

  • Fix XLS problems with larger files

You Might Be Interested In:


Leave a Reply