GitHub - blsrm/ngTableExcelExport: JavaScript export to Excel or CSV from HTML tables automatically in the browser and also compatible with all browsers

ng-table-excel-export.js

JavaScript export to Excel or CSV

A quick JavaScript library to create export to Excel/CSV from HTML tables automatically in the browser. This JS also supporting ng-table export facility.

Revision history:

1.0

  • Customized JS for CSV and Excel data export

Compatibility

Firefox, Chrome, Internet Explorer 10+

Install: Bower

bower install ng-table-excel-export

Install: NPM

npm install ng-table-excel-export

Include script in your HTML:

<script type="text/javascript" src="bower_components/ng-table-excel-export/ng-table-excel-export.min.js"></script>

Usage

<table id="datatable">
    <tr>
        <td>100</td> <td>200</td> <td>300</td>
    </tr>
    <tr>
        <td>400</td> <td>500</td> <td>600</td>
    </tr>
</table>

<a download="download.xls" href="#" onclick="return ngTableExcelExport.excel(this, 'datatable', 'Sheet Name Here');">Export to Excel</a>
<a download="download.csv" href="#" onclick="return ngTableExcelExport.csv(this, 'datatable', 'Sheet Name Here');">Export to CSV</a>
<a download="download.csv" href="#" onclick="return ngTableExcelExport.csv(this, 'datatable', 'Sheet Name Here', ';');">Export to CSV - Using semicolon ";" separator - UTF8</a>

Arguments

  • this - this is js instance as first arguments
  • datatable - name of ID value of table export as second arguments
  • Excel/CSV file name or sheet name as third arguments
  • 4th and 5th are optional arguments applicable for CSV export based on delimiter and newline preferences.