Here we are going to see how to export html table data instead of copying the records manually by using jquery plugin "tableExport" into different format like xls, csv and text.
Following are the necessary files which you need to include into your head section of template,
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/TableExport/4.0.11/css/tableexport.min.css"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script> <script type="text/javascript" src="https://fastcdn.org/FileSaver.js/1.1.20151003/FileSaver.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/TableExport/4.0.11/js/tableexport.min.js"></script>
Add the below script under the your table in boy section,
<script> $("table").tableExport(); </script>
Once this is done, just reload the page and you can see the options to export the table as below.
Now, select the required format to export the table data and save the file to your local as below.
That's all..!