Download HTML Table As A CSV File – TableToCSV

Category: Javascript , Table | June 5, 2021
Authorgouthams96
Last UpdateJune 5, 2021
LicenseMIT
Views1,451 views
Download HTML Table As A CSV File – TableToCSV

Yet another table to csv converter that enables the user to download your HTML table as a CSV file directly from the browser.

How to use it:

1. Import the TableToCSV JavaScript library into the document.

<script src=”dist/table-to-csv.min.js”></script>

2. Convert your HTML table to a CSV file.

const tableToCSV = new TableToCSV("#myTable", {
      filename: "example.csv",
});

3. Download the CSV file when needed.

tableToCSV.download();

4. Customize the delimiter in the CSV file. Default: “-“.

const tableToCSV = new TableToCSV("#myTable", {
      filename: "example.csv",
      delimiter: "-"
});

5. Specify the column index to ignore specific columns when exporting.

const tableToCSV = new TableToCSV("#myTable", {
      filename: "example.csv",
      ignoreColumns: [0],
});

You Might Be Interested In:


Leave a Reply