Click here to Skip to main content
14,298,585 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have attached the html code below.In that on clicking "currency conversion" button the 'xlsx' file which has been selected should convert into 'csv' file. That should be displayed on another page.Please help me to solve this.

What I have tried:

<?DOCTYPE html>
<html>
<head>

<script language="JavaScript" type="text/javascript">
function HandleBrowseClick()
{
    var fileinput = document.getElementById("browse");
    fileinput.click();
}
function Handlechange()
{
var fileinput = document.getElementById("browse");
var textinput = document.getElementById("filename");
textinput.value = fileinput.value;
}
</script>

<style>
table {
    border: 1px solid black;
	bg-color:BLUE;
	
}
</style>
</head>
 <body>
 
 <!--<form name="Form" onsubmit="return validateForm()" method="post">-->
<center>
 <table>
  <tr><td bgcolor="skyblue"> 
      Input file Path::</td>
	
	     <td > <textarea row="3" cols="50" id="filename"  readonly="true"/> 
		  </textarea><td></tr></br>
		  
<tr><td bgcolor="skyblue">  Browse Input File::</td>
	        <td bgcolor="yellow">
	          <input type="file" id="browse" name="fileupload" style="display: none"  onchange="Handlechange();"/>

<input type="button" value="BROWSE FILE"  onclick="HandleBrowseClick();"/>
			   
			   
			    </td></tr></br>
	<tr><td bgcolor="skyblue">Load Input File Data::</td>
	        <td bgcolor="yellow">
	           <input type="submit" value="CURRENCY CONVERSION">
			   
			    </td></tr>	
<tr><td bgcolor="skyblue">Extract CSV files From Input File::</td>
	        <td bgcolor="yellow">
	           <input type="submit" value="VENDOR SUBSIDIARY CSV">
			   
			   
			    </td></tr>					




</table>


</center>

<!--</form>-->

 </body>

</html>
Posted
Updated 19-Jul-18 1:42am

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

I googled "read xlsx file javascript" and this was the first result

json - How to parse Excel file in Javascript/HTML5 - Stack Overflow[^]
   
Comments
Member 13746934 20-Jul-18 1:24am
   
I think it is converting into JSON but not CSV.
F-ES Sitecore 20-Jul-18 4:23am
   
What you convert it into is the easy bit, it's reading from the original file that is going to be hard.
Member 13746934 20-Jul-18 5:43am
   
can you please help in coding for converting excel into csv

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100