Recent news

Monday, 30 May 2016

Ajax Export Of HTML Table Into Excel Sheet Without Page Refresh Using jQuery



jquery-table2excel Is a jQuery plugin which help to export the html table into excel sheet using jQuery. This plugin export table directly into writing extra code. This plugin export data excel file into .xls format.

How To Use

1. Add the below library reference

<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="jquery.table2excel.js"></script>


2. Now add the below html tag.

<table class="table2excel" data-tablename="Test Table 1">
    <thead>
        <tr class="noExl">
            <td>H1</td>
            <td>H2</td>
        </tr>
        <tr>
            <td>H1</td>
            <td>H2</td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>data1a</td>
            <td>data1b</td>
        </tr>
        <tr>
            <td>data2a</td>
            <td>data2b</td>
        </tr>
    </tbody>
    <tfoot>
        <tr>
            <td colspan="2">This footer spans 2 cells</td>
        </tr>
    </tfoot>
</table>


3. Add the below code to perform operation

    $("#yourHtmTable").table2excel({
        exclude: ".excludeThisClass",
        name: "Worksheet Name",
        filename: "SomeFile" //do not include extension
    });



Pranav Singh Author: Pranav Singh

Hello, I am Author of this blog. The main purpose of this blog is to provide all the jQuery plugins which is helpful in designing and developing a web application in a single location from the web.

Previous
Next Post »

E-mail Newsletter

Sign up now to receive breaking news and to hear what's new with us.

Recent Articles