Table To Excel (XSL) Converter - jQuery tableToExcel.js

File Size: 3.88 KB
Views Total: 23904
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Table To Excel (XSL) Converter - jQuery tableToExcel.js

A dead simple jQuery based table to excel converter that generates a downloadable Excel XSL file from an HTML table you provide.

See also:

How to use it:

1. Download and put the JavaScript file jquery.tableToExcel.js after jQuery.

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" 
        integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" 
        crossorigin="anonymous">
</script>
<script src="jquery.tableToExcel.js"></script>

2. Just attach the function to the target HTML table and done.

<table class="table table-bordered table-striped">
  <thead>
    <tr>
      <th>Firstname</th>
      <th>Lastname</th>
      <th>Email</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>John</td>
      <td>Doe</td>
      <td>[email protected]</td>
    </tr>
    <tr>
      <td>Mary</td>
      <td>Moe</td>
      <td>[email protected]</td>
    </tr>
    <tr>
      <td>July</td>
      <td>Dooley</td>
      <td>[email protected]</td>
    </tr>
  </tbody>
</table>
$('table').tblToExcel();

3. Execute a function when the conversion is complete.

$('table').tblToExcel({
  complete: function () {
    // do something
  }
});

Changelog:

2021-07-19

  • fix utf-8

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