TableExport is an open-source JavaScript library that exports HTML tables to xlsx, xls, csv, and txt files entirely in the browser, without any server-side processing. Developed by the GitHub user clarketm and hosted at tableexport.travismclarke.com, it is licensed under Apache-2.0 and can be installed via npm, Bower, or loaded from a CDN. The library accepts one or more HTML table elements and produces downloadable spreadsheet files through auto-generated or custom export buttons.
What is TableExport?
TableExport is a client-side library that takes HTML table markup as input and generates downloadable files in four spreadsheet formats: xlsx, xls, csv, and txt. It runs in any modern browser and requires FileSaver.js for file saving; jQuery and Bootstrap are optional dependencies that enable extra convenience methods and built-in button styling. The library is created by clarketm (Travis Clarke) and is distributed as a standalone script or as an npm package named tableexport.
Key Features
- Multiple export formats — Supports xlsx (via the optional SheetJS xlsx.core.js library), xls, csv, and txt, each with configurable MIME types, separators, and file extensions.
- Automatic export buttons — When
exportButtonsis true, TableExport generates a button for each selected format; withbootstrap: true, these buttons use Bootstrap'sbtn,btn-default, andbtn-toolbarclasses. - Configurable options — The constructor accepts options for headers, footers, filename (from an
idattribute or custom string), sheet name, button position (toporbottom), RTL worksheet direction, and row or column exclusion viaignoreRowsandignoreCols. - Advanced methods — Exposes
getExportData,export2file,getFileSize,update,reset, andremoveso developers can build fully custom export workflows or modify the instance after creation. - CSS selector filters — The
ignoreCSSandemptyCSSprototype settings let you exclude or blank cells by matching any CSS selector or array of selectors. - jQuery integration — Works with or without jQuery; when jQuery is loaded, you can call
$("table").tableExport()directly. - Format-specific overrides — The
formatConfigprototype object allows per-format changes to class names, button content, MIME type, separator, and file extension (for example, changing CSV's MIME type). - International and data-type support — Documented examples include Arabic (right-to-left) text, emoji, and cell data types such as string, number, boolean, and date.
Who is it for?
- Front-end developers — Add client-side export functionality to dashboards, reporting tools, or any page with HTML tables, eliminating the need for server-generated spreadsheets.
- jQuery users — Take advantage of the familiar
$("table").tableExport()syntax and the optional Bootstrap styling that matches existing jQuery plugin ecosystems. - Bootstrap-based project developers — Style export buttons seamlessly with Bootstrap 3.1.0 or higher by setting
bootstrap: true. - Single-page application developers — Integrate TableExport into Angular, Webpack, RequireJS, or Flask projects using the provided skeleton repositories.
What can you do with TableExport?
- Data analysts — Export HTML tables to CSV or TXT for further processing in spreadsheet tools or data analysis pipelines.
- Financial reporting dashboards — Generate XLSX files with a custom sheet name, header/footer rows, and right-to-left layout for Arabic language reports.
- Web app developers — Use
getExportDataandexport2fileto create custom download buttons that trigger exports with specific MIME types and filenames. - Legacy browser maintainers — Include Blob.js (via the provided fork) to support old browsers like Chrome below version 20, Firefox below 13, and IE below 10.
How does TableExport work?
The setup involves including FileSaver.js and tableexport.js (plus xlsx.core.js if you need xlsx export) via script tags or a package manager. Then you call new TableExport(document.getElementsByTagName("table")) or the jQuery variant $("table").tableExport(), optionally passing configuration properties. TableExport reads the table's header, footer, and body rows, applies any ignore or empty rules, and attaches download buttons that convert the table content to the chosen file format on click.
Pros and cons
- Pros: Free and open source under Apache-2.0; no server-side code required; supports four file formats; highly configurable via options and prototype settings; works with or without jQuery; well-documented with migration guides and examples.
- Cons: XLSX support requires the separate SheetJS library; PDF export is listed as a TODO and is not yet available; the oldest browsers need an additional Blob.js polyfill.
Pricing
TableExport is free to use and distributed under the Apache License 2.0. There are no paid tiers or premium features; the source code is available on GitHub and via npm, Bower, and unpkg CDN.
FAQ
Is TableExport free?
Yes, TableExport is open source and released under the Apache-2.0 License. You can use it in commercial and personal projects without paying any licensing fees, and the full source is available on GitHub.
What file formats does TableExport support?
TableExport can export HTML tables to xlsx, xls, csv, and txt. By default it exports xlsx, csv, and txt; you can change the formats option to include xls or restrict to only certain filetypes. XLSX support requires including the optional SheetJS xlsx.core.js file.
Does TableExport require jQuery?
No, jQuery is optional. TableExport works with plain JavaScript using the new TableExport constructor, and it also provides a jQuery plugin method $("table").tableExport() when jQuery is present. The library is designed to function fully without jQuery.
How do I enable xlsx export?
To use the xlsx format, you must include the third-party library xlsx.core.js from SheetJS before FileSaver.js and tableexport.js in your HTML. However, if you install TableExport via Bower or npm, xlsx support is bundled and does not require a separate script tag.
Which browsers are supported?
TableExport works on Chrome, Firefox, Opera, and Safari across Android, iOS, Mac OSX, and Windows, and on Internet Explorer on Windows. Very old browsers — Chrome below 20, Firefox below 13, Opera below 12.10, IE below 10, and Safari below 6 — require the Blob.js polyfill from the provided fork.








