Export JavaScript/JSON Data To Excel (XLSX) - JHXLSX

Export JavaScript/JSON Data To Excel (XLSX) - JHXLSX
File Size: 22.3 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

JHXLSX is a jQuery dependent JavaScript library to download or create Excel XLSX spreadsheets using JavaScript (JSON).

This library is fully dynamic and flexible we can merge and set styling on each cell. Useful for creating an online JSON/JS Objects To XLSX(XML spreadsheet) converter.


  • jQuery library.
  • js-xlsx: Spreadsheet parser and writer
  • FileSaver.js: HTML5 saveAs() FileSaver implementation

See also:

How to use it:

1. Load jQuery library and other required resources in the document.

<script src="https://code.jquery.com/jquery-3.3.1.min.js" 
<script src="js/xlsx.core.min.js"></script>
<script src="js/FileSaver.js"></script>

2. Load the JHXLSX plugin's script after jQuery.

<script src="js/jhxlsx.js"></script>

3. Prepare your data in the JavaScript.

var tabularData = [{
    "sheetName": "Sheet1",
    "data": [[{"text":"Name"},{"text":"Position"},{"text":"Office"},{"text":"Age"},{"text":"Start date"},{"text":"Salary"}],[{"text":"Tiger Nixon"},{"text":"System Architect"},{"text":"Edinburgh"},{"text":61},{"text":"2011/04/25"},{"text":"$320,800"}],[{"text":"Garrett Winters"},{"text":"Accountant"},{"text":"Tokyo"},{"text":63},{"text":"2011/07/25"},{"text":"$170,750"}],[{"text":"Ashton Cox"},{"text":"Junior Technical Author"},{"text":"San Francisco"},{"text":66},{"text":"2009/01/12"},{"text":"$86,000"}],[{"text":"Cedric Kelly"},{"text":"Senior Javascript Developer"},{"text":"Edinburgh"},{"text":22},{"text":"2012/03/29"},{"text":"$433,060"}],[{"text":"Airi Satou"},{"text":"Accountant"},{"text":"Tokyo"},{"text":33},{"text":"2008/11/28"},{"text":"$162,700"}],[{"text":"Brielle Williamson"},{"text":"Integration Specialist"},{"text":"New York"},{"text":61},{"text":"2012/12/02"},{"text":"$372,000"}],[{"text":"Herrod Chandler"},{"text":"Sales Assistant"},{"text":"San Francisco"},{"text":59},{"text":"2012/08/06"},{"text":"$137,500"}],[{"text":"Rhona Davidson"},{"text":"Integration Specialist"},{"text":"Tokyo"},{"text":55},{"text":"2010/10/14"},{"text":"$327,900"}]]

4. Export your data into a downloadable XLSX file.

var options = {
    fileName: "File Name"
Jhxlsx.export(tabularData, options);

5. To load the data from an external JSON file:

// data.json
  "options": {
    // options here
  "tabularData": [
    // data here
var url = 'data.json';
$.get(url, {}, function (data) {
    Jhxlsx.export(data.tabularData, data.options);
}).fail(function (jqXHR) {
    alert("error: " + jqXHR.status + " / " + jqXHR.statusText);

6. All default plugin options:

var options = {
    fileName: "jhreport",
    extension: ".xlsx",
    sheetName: "Sheet",
    fileFullName: "report.xlsx",
    header: true,
    maxCellWidth: 20



  • export improvement added row merging feature

This awesome jQuery plugin is developed by skmaurya33. For more Advanced Usages, please check the demo page or visit the official website.