Exporting HTML Table To XSL / CSV Documents With jQuery - table2download

Exporting HTML Table To XSL / CSV Documents With jQuery - table2download
File Size: 4.63 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

table2download is a jQuery plugin which helps parse and convert html table data into downloadable XSL and/or CSV document files.

How to use it:

1. Include the latest version of jQuery library and the jQuery table2download plugin on the webpage.

<script src="//code.jquery.com/jquery-3.0.0.js"></script>
<script src="js/table2download.js"></script>

2. Call the plugin to generate a download button underneath the target html table.

$("table").table_download();

3. By default the plugin will convert the html table into a downloadable file in XLS format. You can change the file format using the 'format' options during init as follows:

$("table").table_download({
  format: "csv"
});

4. More configuration options.

$("table").table_download({
  format: "csv",
  separator: ",",
  filename: "data",
  linkname: "Export",
  quotes: "\"",
  newline: "\r\n"
});

5. Style the download button whatever you like.

.table_download_csv_link, .table_download_xls_link {
  margin: 10px;
  display: inline-block;
  padding: 10px;
  background-color: #1ABC9C;
  border-bottom: 3px solid #16A085;
  text-align: center;
  line-height: 30px;
  border-radius: 5px;
  color: #fff;
}

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