My readers continuously asked me to work on how to export html table data instead of copying the records manually. So I thought to share this wonderful jquery plugin I have come across via google to my readers.

This plugin is very easy to implement it in your projects who wants to export the html table data instantly.

Beauty of this jQuery plugin is which allows you to download any html table data into all downloadable formats. This is the must required plugin for any reporting / statistics kind of projects

Export HTML Table Data to Excel, CSV, PDF

Export HTML Table Data to Excel, CSV, PDF

Plugin Features

We can easily export any html tables to the following formats

  1. JSON
  2. XML
  3. PNG
  4. CSV
  5. TXT
  6. SQL
  7. MS-Word
  8. Ms-Excel
  9. Ms-Powerpoint
  10. PDF

Installation

You need an jquery plugin to support this feature

<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="tableExport.js">
<script type="text/javascript" src="jquery.base64.js">

For exporting html table to PNG format

You need an below script to export html table data to PNG format. html2canvas.js

<script type="text/javascript" src="html2canvas.js">

For exporting html table data into PDF format

<script type="text/javascript" src="jspdf/libs/sprintf.js">
<script type="text/javascript" src="jspdf/jspdf.js">
<script type="text/javascript" src="jspdf/libs/base64.js">

Usage

<a href="#" onClick ="$('#tableID').tableExport({type:'json',escape:'false'});">JSON</a>
<a href="#" onClick ="$('#tableID').tableExport({type:'excel',escape:'false'});">XLS</a>
<a href="#" onClick ="$('#tableID').tableExport({type:'csv',escape:'false'});">CSV</a>
<a href="#" onClick ="$('#tableID').tableExport({type:'pdf',escape:'false'});">PDF</a>

Other Types

{type:'json',escape:'false'}
{type:'json',escape:'false',ignoreColumn:'[2,3]'}
{type:'json',escape:'true'}
{type:'xml',escape:'false'}
{type:'sql'}
{type:'csv',escape:'false'}
{type:'txt',escape:'false'}
{type:'excel',escape:'false'}
{type:'doc',escape:'false'}
{type:'powerpoint',escape:'false'}
{type:'png',escape:'false'}
{type:'pdf',pdfFontSize:'7',escape:'false'}

View Live Demo & Download

 

20,000+ SUBSCRIBERS CAN’T GO WRONG !!!
Subscribe and get access to 200+ Demo scripts for FREE!

 

Credit – https://github.com/kayalshri/tableExport.jquery.plugin


Source: W3Lessons