jQuery Plugin To Convert CSV File Into Data Table

File Size: 43.3 KB
Views Total: 21030
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Convert CSV File Into Data Table

CSV to HTML Table is a JavaScript library that uses jQuery CSV to parse your CSV file and convert data into a searchable, filterable, sortable data table based on jQuery datatables plugin.

See also:

How to use it:

1. Load jQuery library and other necessary resources in the html page.

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/dataTables.bootstrap.css" rel="stylesheet">
  ...
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.csv.min.js"></script>
<script src="js/jquery.dataTables.min.js"></script>
<script src="js/dataTables.bootstrap.js"></script>

2. Download and load the csv_to_html_table.js script after jQuery library.

<script src='js/csv_to_html_table.js'></script>

3. Create an element which will be served as the container for the data table.

<div id="table-container"></div>

4. Initialize the plugin and set the data source and target container.

init_table({
  csv_path: 'data/Health Clinics in Chicago.csv', 
  element: 'table-container', 
  // More options go here
});

5. Full options.

init_table({

  // path to your CSV file
  csv_path: 'data/Health Clinics in Chicago.csv', 

  // targer element
  element: 'table-container', 
  
  // jQuery CSV Plugin Options
  csv_options: {...},

  // jQuery Datatables Plugin Options
  datatables_options: {...}
  
});

This awesome jQuery plugin is developed by derekeder. For more Advanced Usages, please check the demo page or visit the official website.