<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SheetJS Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/sheetjs/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/sheetjs/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Wed, 13 Apr 2022 16:30:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>How to Display Excel Data in HTML Table using JavaScript?</title>
		<link>https://www.scmgalaxy.com/tutorials/how-to-display-excel-data-in-html-table-using-javascript/</link>
					<comments>https://www.scmgalaxy.com/tutorials/how-to-display-excel-data-in-html-table-using-javascript/#comments</comments>
		
		<dc:creator><![CDATA[rajeshkumar]]></dc:creator>
		<pubDate>Mon, 23 Aug 2021 12:36:59 +0000</pubDate>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Excel data]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[SheetJS]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=8225</guid>

					<description><![CDATA[<p>In this tutorial, you can find how to read excel files using javascript and display excel sheet data on web [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-display-excel-data-in-html-table-using-javascript/">How to Display Excel Data in HTML Table using JavaScript?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">In this tutorial, you can find how to read excel files using javascript and display excel sheet data on web pages in HTML table format using javascript. In the previous, one of our tutorials, in which we have already seen how to convert HTML table data to Excel files using the SheetJS library. Now in this tutorial also we will be using the SheetJS JavaScript library and by using the JavaScript library, we will convert the Excel file data into an HTML table and display it on the web page.</p>



<p class="wp-block-paragraph">First, we have to include the Bootstrap Stylesheet and SheetJS library link at the header of our HTML page.</p>



<script src="https://gist.github.com/vijaypk376/788458c02d4e0655916f6812ffda9789.js"></script>



<p class="wp-block-paragraph">After this under this HTML page, we have to create one file tag for select file excel from the local computer.</p>



<script src="https://gist.github.com/vijaypk376/233239029acc727d860469801bf59c99.js"></script>



<p class="wp-block-paragraph">And below this file, we have to create one division tag to display excel sheet data on the web page in HTML table format.</p>



<script src="https://gist.github.com/vijaypk376/afd30ca2542d12b76128671a7d9e3a84.js"></script>



<p class="wp-block-paragraph">Next, we have to move on to writing JavaScript code, so first store file tag property under one variable.</p>



<script src="https://gist.github.com/vijaypk376/d4be00655835b4c2c340efc711ba054d.js"></script>



<p class="wp-block-paragraph">Next, we need to write the JavaScript code on the change event, so when the user has selected a file from the local computer using the file tag, the JavaScript code should be executed.</p>



excel_file.addEventListener(&#8216;change&#8217;, (event) => {

});



<p class="wp-block-paragraph">Under this change event code first, we want to check the selected file format .xls or .xlsx. If the selected file is not an Excel file then it will display an error on the web page, and if the selected file is Excel then it will proceed to display the Excel file data on the web page.</p>



<script src="https://gist.github.com/vijaypk376/f04202ed682df8dc8687a960dcfca4c0.js"></script>



<p class="wp-block-paragraph">After a check, the validation error, now read the file using the FileReader object. Here file must be read ads ArrayBuffer bypassing the file object using event.target.files[0].</p>



<script src="https://gist.github.com/vijaypk376/8be06c6a6b25b4fa472d5e16b4c27775.js"></script>



<p class="wp-block-paragraph">IF the selected file is a proper excel file then we need to convert what we have got from the FileReader object to Unit8Array object by passing Filereader result into Unit8Array constructor.</p>



<script src="https://gist.github.com/vijaypk376/6d01be7805d6410eed503fcd86e2bf24.js"></script>



<p class="wp-block-paragraph">Next, we have pass this Unit8Array data in SheetJS read() function, and it will return the selected excel workbook object.</p>



<script src="https://gist.github.com/vijaypk376/a21523ccac78e5eb66847ebe6c24337c.js"></script>



<p class="wp-block-paragraph">After getting the workbook object, next we have to get the sheet name of the selected excel file. So here <strong>SheetNames</strong> variable will return sheet name in array format.</p>



<script src="https://gist.github.com/vijaypk376/82fc8f0d2377710a061dc8389757dbc4.js"></script>



<p class="wp-block-paragraph">Once we have to get the sheet name, now we want to get the first sheet data in JSON format, so we can get by SheetJS sheet_to_json() function by passing the workbook first sheet name.</p>



<script src="https://gist.github.com/vijaypk376/26262216825c74616dd9597bc0c9d47c.js"></script>



<p class="wp-block-paragraph">Once we have to get the first sheet data in JSON format, next we have to simply write JavaScript code and convert that JSON data into an HTML format and display it under division tag with id <strong>excel_data</strong>. So it will display excel file data on the web page in HTML table format.</p>



<script src="https://gist.github.com/vijaypk376/934d0d2934325bb8f7221742f14668cb.js"></script>



<p class="wp-block-paragraph">So once you have followed all the above steps then you can check output in the browser. So when we have selected an excel file then it will display excel sheet data on the web page in HTML table format without a refresh of the web page. So in this tutorial, we have seen how to convert Excel files to HTML tables at the client-side by using the SheetJS JavaScript library at the client-side. You can find the complete source code here.</p>



<script src="https://gist.github.com/vijaypk376/37e0604593a13b74fd8f2e8e39a0e539.js"></script>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/how-to-display-excel-data-in-html-table-using-javascript/">How to Display Excel Data in HTML Table using JavaScript?</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/how-to-display-excel-data-in-html-table-using-javascript/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
	</channel>
</rss>
