v4 docs
The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files.
Deprecation notice:
Below are the docs for v4.0.11.
v4.0.11.Check out v5 for the latest release.
v5 for the latest release.Docs
Getting Started
Install manually using <script> tags
<script> tagsTo use this library, include the FileSaver.js library, and TableExport library before the closing <body> tag of your HTML document:
Install with Bower
Install with npm
CDN
CDNjs
unpkg
Dependencies
Required:
Optional:
Add-Ons:
In order to provide Office Open XML SpreadsheetML Format ( .xlsx ) support, you must include the following third-party library in your project before both FileSaver.js and TableExport.
xlsx.core.js by SheetJS
Including
xlsx.core.jsis NOT necessary if installing withBowerornpm
Older Browsers:
To support legacy browsers ( Chrome < 20, Firefox < 13, Opera < 12.10, IE < 10, Safari < 6 ) include the Blob.js polyfill before the FileSaver.js script.
Blob.js by eligrey (forked by clarketm)
Including
Blob.jsis NOT necessary if installing withBowerornpm
Usage
JavaScript
To use this library, simple call the TableExport constructor:
Additional properties can be passed-in to customize the look and feel of your tables, buttons, and exported data.
Notice that by default, TableExport will create export buttons for three different filetypes xls, csv, txt. You can choose which buttons to generate by setting the formats property to the filetype(s) of your choice.
Note: to use the
xlsxfiletype, you must include js-xlsx; reference theAdd-Onssection.
Properties
Methods
TableExport supports additional methods (getExportData, update, reset and remove) to control the TableExport instance after creation.
getExportData
update
reset
remove
Settings
Below are some of the popular configurable settings to customize the functionality of the library.
ignoreCSS
emptyCSS
CSS
TableExport packages with customized Bootstrap CSS stylesheets to deliver enhanced table and button styling. These styles can be enabled by initializing with the bootstrap property set to true.
When used alongside Bootstrap, there are four custom classes .xlsx, .xls, .csv, .txt providing button styling for each of the exportable filetypes.
Browser Support
Chrome
Firefox
IE
Opera
Safari
Android
✓
✓
-
✓
-
iOS
✓
-
-
-
✓
Mac OSX
✓
✓
-
✓
✓
Windows
✓
✓
✓
✓
✓
A full list of browser support can be found in the FileSaver.js README. Some legacy browsers may require an additional third-party dependency: Blob.js
Examples
Customizing Properties
Customizing Settings
Miscellaneous
cell data types(string,number,boolean,date)
Skeletons
TableExport + RequireJS skeleton.
TableExport + Flask skeleton.
TableExport + Webpack 1 skeleton.
TableExport + Angular 4 + Webpack 2 skeleton.
License
TableExport is licensed under the terms of the Apache-2.0 License
Going Forward
TODOs
Credits
Special thanks the the following contributors:
Last updated
Was this helpful?