Skip to content
This tool converts and HTML table to CSV file
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


This tool converts an HTML table to CSV file

Getting Started

If you like me, have a problem when you want to convert an HTML table to some excel format (CSV for example) and you don't want to create a backend service to create that file, you can use this tool. I didn't found a library that I liked to do this (December 2017), that's why I decided to make my own tool. This tool is a pure Javascript, you don't need any other dependencies.


All you have to do, is to add the tableToCSV.js file into your main HTML (maybe index.html)

<script src="tableToCSV.js"></script>

And then, call the function (you can add the action in a button for example):


At the end of the execution, you will see a window just to save your file in CSV format

Or you can install via bower:

bower install table-to-csv

Full example

HTML file (angularJS example)

    <table id="idOfTheTable">
          <th>Second title</th>
	      <th>Third title</th>
	      <th>More titles</th>
	      <th>More titles</th>
    <button ng-click="exportData()">Generate</button>

Controller function

$scope.exportData = function(){

This will generate a file with CSV format like this:

Title1, Second title, Third title, More titles, More titles
row1-1, row1-2, row1-3, test, child
row2-1, row2-2, row2-3, test, child
row2-1, row2-2, row2-3, test, child


Please read for details on our code of conduct, and the process for submitting pull requests to us.

We use SemVer for versioning. For the versions available, see the tags on this repository.


  • Cristian Alanis - Initial work


This project is licensed under the Apache License 2.0 - see the LICENSE file for details

You can’t perform that action at this time.