step 1 add css

https://cdnjs.cloudflare.com/ajax/libs/TableExport/4.0.11/css/tableexport.css

 

step 2 add js

step 3 call tableExport
$(function() {
$(‘table’).tableExport({
bootstrap:true
});
});
step 4 create table data
<table id=”export-data” width=”100%” border=”1″>
<thead>
<tr>
<th>Name</th>
<th>Position</th>
<th>Age</th>
<th>Salary</th>
</tr>
</thead>
<tbody>
<tr>
<td>Thor Walton</td>
<td>Regional Director</td>
<td>45</td>
<td>$98,540</td>
</tr>
<tr>
<td>Travis Clarke</td>
<td>Software Engineer</td>
<td>30</td>
<td>$275,000</td>
</tr>
<tr>
<td>Suki Burks</td>
<td>Office Manager</td>
<td>22</td>
<td>$67,670</td>
</tr>
</tbody>
<tfoot>
<tr>
<td></td>
<td></td>
<td></td>
<th>$441,210</th>
</tr>
</tfoot>
</table>