jQuery Plugin For Exporting HTML Tables to CSV

jQuery Table To Csv is a small, configurable table to CSV converter that allows you to convert HTML table to CSV data.

Optionally, the plugin has the ability to automatically export and download data as a CSV file so that you can edit/modify it in Excel.

Must Read – jQuery Plugin for Transforming HTML Tables Into Charts Using Google Charts

How to make use of it:

1. Load the tableToCsv.min.js script earlier than the closing body tag.

<script src="/path/to/cdn/jquery.slim.min.js"></script>
<script src="/path/to/dist/tableToCsv.min.js"></script>

2. Call the perform tableToCsv in your HTML table and specify the file title as follows:

$('table').tableToCsv({
  filename: 'example.csv'
});

3. Disable Auto-Download and append the converted CSV information to a container you specify.

let csv = $('table').tableToCsv({
    autoDownload: false
});
$('#output').html(csv);

4. Change the value separator (delimiter) in CSV.

$('table').tableToCsv({
  filename: 'example.csv',
  separator: '.',
});

5. Specify the Colspan mode: empty or replicate.

$('table').tableToCsv({
  filename: 'example.csv',
  colspanMode: 'replicate',
});

6. Available event handlers.

$('table').tableToCsv({
  fn_onInit: null,
  fn_onComplete: null,
  fn_onError: null
});

Must Read – Javascript Library to Make HTML Table Editable With Bootstrap

Parameters

ParameterTypeDefaultRequiredDescription
filenamestringnull✔️/✖️Name of the CSV file, required if autoDownload is enabled.
separatorstring','✖️CSV field separator token
colspanModestring'empty'✖️Colspan mode, can be: empty or replicate
autoDownloadbooleantrue✖️If true, auto starts a download after conversion, otherwise, returns the csv content
fn_onInitfunctionnull✖️Called before proccess start
fn_onCompletefunctionnull✖️Called before download/return csv content
fn_onErrorfunctionnull✖️Called when a error occurs on the proccess

Convert HTML Table Into CSV, jQuery Table To Csv Plugin/Github, export div to csv javascript, convert html table to excel

Read More – 

Create Amazing Web-Based Interactive Tables and Spreadsheets | Jspreadsheet CE
Apply a Simple Spreadsheet UI to the HTML Table Tag | sheetjs


See Demo And Download

Official Website(PauloAK): Click Here

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

Share