Export Html Table To Excel Spreadsheet using jQuery - table2excel

Export Html Table To Excel Spreadsheet using jQuery - table2excel
File Size: 16.1 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

table2excel is a simple yet useful jQuery plugin which allows for exporting Html table data to an Excel file.

How to use it:

1. Include jQuery library and the jQuery table2excel plugin in the Html document.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="src/jquery.table2excel.js"></script>

2. Create an 'Export' button to export table data to an Excel file manually. Optional.

<button>Export</button>

3. Call the plugin on the table and done.

$("button").click(function(){
  $("#table2excel").table2excel({
    // exclude CSS class
    exclude: ".noExl",
    name: "Worksheet Name",
    filename: "SomeFile" //do not include extension
  }); 
});

4. You can add the CSS class 'noExl' to any tr tags to ignore the specified table data while exporting.

<tr class="noExl">
  <th>#</th>
  <th>Column heading</th>
  <th>Column heading</th>
  <th>Column heading</th>
</tr>

Change logs:

2017-05-26

  • v1.1.1: Update jquery.table2excel.js

2016-03-08

  • Support unicode and file extension feature.

2015-05-22

  • Update jquery.table2excel.js

2015-04-08

  • Added IE11 support

2015-04-04

  • Changes made to move toward supporting multiple tables to single Excel file.

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