Simple jQuery Plugin for Converting HTML Tables to CSV | table2csv

table2csv is a simple jQuery plugin for converting HTML tables to CSV. It allows you to download or view plain HTML table content as a CSV file.

It’s useful if you want to quickly create a downloadable report from a web-based tool.

export html table to excel using jquery plugin, tableexport jquery plugin example, table2excel, export html table data to excel using jquery without plugin, export html table to excel using javascript

How to make use of it:

1. Load the jQuery library and jQuery table2csv plugin when needed.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="src/table2csv.js"></script>

2. Export your table to a downloadable CSV file.

$("table").table2csv();

3. Analyze and output table data in CSV format.

$("table").table2csv('output', {
  appendTo: '#out'
});

4. Select the file name.

$("table").table2csv({
  filename: 'table.csv'
});

5. General settings with default values.

$("table").table2csv({
  separator: ',',
  newline: '\n',
  quoteFields: true,
  excludeColumns: '',
  excludeRows: ''
  trimContent: true // Trims the content of individual <th>, <td> tags of whitespaces. 
});

6. Return the CSV file as a string instead.

$("#table").table2csv('return');

Options

General options

  • separator
    default: ','
    The field separator to use in the csv

  • newline
    default: '\n'
    The line separator to use in the csv

  • quoteFields
    default: true
    Whether to quote fields in the csv

  • excludeColumns
    default: ''
    jQuery selector for the columns you don’t want to export in the csv (tipically a list of classes)

  • excludeRows
    default: ''
    jQuery selector for the rows you don’t want to export in the csv (tipically a list of classes)

  • trimContent
    default: true
    Trims the content of individual <th>, <td> tags of whitespaces. This will produce valid output even if the table is indented.

Download options

These options apply only when the ‘download’ action is used

  • filename
    default: 'table.csv'
    This is the name given to the file when the ‘download’ action is invoked

Output options

These options apply only when the ‘output’ action is used

  • appendTo
    default: 'body'
    jQuery selector of the element inside which append the generated csv text. This is only used when the ‘output’ action is invoked
jQuery Plugin To Export Table Data To CSV File, table2csv Plugin/Github, jquery export to excel with formatting, table2excel export all pages

See Demo And Download

Official Website(OmbraDiFenice): Click Here

This superior jQuery/javascript plugin is developed by OmbraDiFenice. For extra Advanced Usages, please go to the official website.

Related Posts

Confetti-Falling-Animation-Effect-party

Confetti Falling Animation Effect In JavaScript | party.js

Party.js is a JavaScript library to brighten user site experience with visual effects! Celebrate success with dom confetti! The library is written in TypeScript and compiled into…

Star-Rating-JavaScript

Select Box Based Star Rating JavaScript Library | star-rating.js

star-rating.js is a small JavaScript library to create a customizable and gradually improved star rating control from a regular tick box with numeric values. The ES6 module…

Bootstrap-Show-Notification

Corner Fixed Notifications Alerts With Bootstrap | BS4 Show Notification

Bootstrap Notification is an easy-to-use jQuery plugin that uses the Bootstrap Alerts component to create static, rejectable, and stackable notification popups in the upper right corner of the…

Stackable-Multi-level-Sidebar-Menu

Create Stackable Multi-level Sidebar Menu | HC Off-canvas Nav

Multi-Level Sidebar Slide Menu – HC MobileNav is a jQuery plugin for creating multi-level, mobile-first, totally accessible, off-canvas facet navigation that helps the infinite nesting of submenu…

bootstrap-5-bs-toaster

A Bootstrap 5 Toast Notification Framework Library | bs-toaster

bs-toaster is simple to instantiate bs-toaster and create multiple toasts effortlessly using native Bootstrap 5! Feature Facts Small and clean Modern browser support. No IE sorry 💥…

Skeleton-Screen-Loading-In-Pure-CSS

How to Create a Skeleton Screen Loading In Pure CSS

Skeleton Screen CSS is a complete set of elements for a hierarchical screen consisting of pure CSS. The source includes scss and compiled thumbnail and non-thumbnail CSS…