🔔 Alert..!! Get 2 Month Free Cloud Hosting With $200 Bonus From Digital Ocean ACTIVATE DEAL

tableExport is a lightweight yet customizable jQuery plugin for exporting your html table to other types of documents: CSV, XLS, TXT and SQL.

table-export json

Documentation

jQuery Table Exporter

This is a simple jQuery plug-in that allows exporting html tables to CSV, XLS, TXT, SQL, JSON.

Example work

Usage

Import the script before </body>:

<script type="text/javascript" src="tableExport.js"></script>

And add this code to your javascript file:

$('.table').tableExport({   filename: 'table',   format: 'csv', });

.table - The class name of the exported table.

(or using options):

$('.table').tableExport({   filename: 'table_%DD%-%MM%-%YY%', // the filename prefix + date format (the extension is automatic)   format: 'xls', // type of your export file: csv, xls, txt, sql, json   cols: '2,3,4', // export of specified columns });

Exclude columns

$('.table').tableExport({   filename: 'table_%DD%-%MM%-%YY%',   format: 'csv',   excludeCols: '1,5', });

Call events

$('.table').tableExport({   filename: 'table_%DD%-%MM%-%YY%',   onbefore: function() {     alert('The export of tables begins!');   },   onafter: function() {     alert('Export complete :)');   }, });

Date format

  • %DD% — day
  • %MM% — month
  • %YY% — year
  • %hh% — hours
  • %mm% — minutes
  • %ss% — seconds

Options

  • filename — the name of the exported file (without extension)
  • format — the export file format (only: csv, xls, txt, sql, json)
  • cols — select specific columns for export
  • excludeCols — excludes specified columns when exporting
  • head_delimiter — separator for titles when exporting
  • column_delimiter — separator for column when exporting
  • onbefore(this) — Function to call before trigger is called
  • onafter(this) — Function to call after trigger is called

Demos

More demos in the examples folder. Or on the links below :)

To Do

  • Parsing date
  • Exporting SQL
  • Support Safari browser

30.11.2017

  • UPD: JSON Exporting
  • Bug fixes

Contacts

License

Now licensed under the MIT License: http://deuxhuithuit.mit-license.org


You May Also Like