Download HTML Table As A CSV File – TableToCSV

Category: Javascript , Table | June 5, 2021
Author:gouthams96
Views Total:1,091 views
Official Page:Go to website
Last Update:June 5, 2021
License:MIT

Preview:

Download HTML Table As A CSV File – TableToCSV

Description:

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