Author: | masifi |
---|---|
Views Total: | 4,283 views |
Official Page: | Go to website |
Last Update: | January 11, 2020 |
License: | MIT |
Preview:

Description:
A vanilla JavaScript Table To Excel exporter that enables the user to download tabula data as an Excel file (xls).
See also:
How to use it:
1. Download and import the minified version of the table2excel.js library into the document.
<script src="table2excel.min.js"></script>
2. Convert the HTML table into an Excel file.
<table class="table table-dark" id="example"> <thead> <tr> <th scope="col">#</th> <th scope="col">First</th> <th scope="col">Last</th> <th scope="col">Handle</th> </tr> </thead> <tbody> <tr> <th scope="row">1</th> <td>Mark</td> <td>Otto</td> <td>@mdo</td> </tr> <tr> <th scope="row">2</th> <td>Jacob</td> <td>Thornton</td> <td>@fat</td> </tr> <tr> <th scope="row">3</th> <td>Larry</td> <td>the Bird</td> <td>@twitter</td> </tr> </tbody> </table>
let t2e = new Table2Excel('#example');
3. Export and download the Excel file.
t2e.export();
4. Customize the file name.
let t2e = new Table2Excel('#example', { filename: "cssscript" });
5. Define the table rows (CSS class) to ignore.
let t2e = new Table2Excel('#example', { exlude: 'ignore' });