Download excel file using jQuery with example : उदाहरण के साथ jQuery का उपयोग करके एक्सेल फ़ाइल डाउनलोड करें

Download excel file using jQuery with example

Download excel file using jQuery is very simple. You follow given bellow steps (jQuery का उपयोग करके एक्सेल फ़ाइल डाउनलोड करना बहुत आसान है। नीचे दिए गए चरणों का पालन करें)-

Step : 1Create HTML button to Download Excel file (एक्सेल फ़ाइल डाउनलोड करने के लिए पहले HTML फाइल में बटन बनाएँ) –

Download excel file using jQuery
<!DOCTYPE>  
<html>  
<head>  
<title> Download Excel </title>  
</head>  
<body>  
<p> 
<input type="button" id="ExportButton" value="Click here to Download Excel" />
<p>
</body>  
</html>

Step : 2 – Add jquery.min.js and table2excel.js library in header section. (हेडर अनुभाग में jquery.min.js तथा table2excel.js लाइब्रेरी जोड़ें)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://rawgit.com/unconditional/jquery-table2excel/master/src/jquery.table2excel.js"></script>
<script type="text/javascript">
	$(function () {
          /* button id 'ExportButton' */
		$("#ExportButton").click(function () { 
           /* HTML table id 'tblListId' */
			$("#tblListId").table2excel({ 
				filename: "Data-Report.xls"
			});
		});
	});
</script>

Step : 3 – Add HTML Table in body section (मुख्य भाग में HTML तालिका जोड़ें).

<table id="tblListId" cellspacing="0" width="100%">	
	<tr>                 
		<th>Sr. No.</th>
		<th>First Name</th>
		<th>Last Name</th>
		<th>Mobile No.</th>				                  
		<th>Address</th>					
	</tr>               
	<tr>                     
		<td>1</td>
		<td>Aman</td>				
		<td>Singh</td>			
		<td>1111111111</td>
		<td>H.No.-E/125</td>								  
	</tr> 
	<tr>                     
		<td>2</td>
		<td>Ashok</td>				
		<td>Singh</td>				
		<td>2222222222</td>
		<td>H.No.-E/130</td>								  
	</tr> 
</table>

How to Add CAPTCHA in CodeIgniter…

Download excel file using jQuery with example

Tags: Download Excel File using AJAX in jQuery, Download excel file using jQuery with example, Download Excel using JavaScript, Export HTML Table in Excel jQuery

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *