View on GitHub

table2csv

Lightweight library to convert HTML table to CSV file

Installation

Add following HTML before body end:

<script src="https://yunisdev.github.io/table2csv/table2csv.min.js"></script>
<!-- or -->
<script src="https://unpkg.com/yunisdev-table2csv"></script>

or you can install using npm:

npm i yunisdev-table2csv

Usage

You can use this library using following syntax:

<button class="table-btn" onclick="table2csv(this,1)" data-table="usersTable">Download</button>