How can i save the inputs given to a form in a excel sheet in my PC ?
Here is sample code which can extract the HTML form data to Excel sheet.
<html>
<head>
<script type="text/javascript">
function CreateExcelSheet()
{
var x=myTable.rows
var xls = new ActiveXObject("Excel.Application")
xls.visible = true
xls.Workbooks.Add
for (i = 0; i < x.length; i++)
{
var y = x.cells
for (j = 0; j < y.length; j++)
{
xls.Cells( i+1, j+1).Value = y[j].innerText
}
}
}
</script>
</head>
<body marginheight="0" marginwidth="0">
<form>
<input type="button" onclick="CreateExcelSheet()" value="Create Excel Sheet">
</form>
<table id="myTable" border="1">
<tr> <b><td>Name </td> <td>Age</td></b></tr>
<tr> <td>Alex </td> <td>25</td> </tr>
<tr> <td>Jamay </td> <td>28</td> </tr>
<tr> <td>Logs</td> <td>57</td> </tr>
<tr> <td>Kas</td> <td>54</td> </tr>
<tr> <td>Sent </td> <td>26</td> </tr>
<tr> <td>Bruce </td> <td>7</td> </tr>
</table>
</body>
</html>
Hope you understand the code …easily .
2 Likes
thanks a lot …i dint start my javascript course still…i’ll try this code after i get an abstract about javascript in few weeks atleast
Please want to know if I should created my excel database first? How should I save my excel sheet? And also should I create excel folder in same folder with HTML and CSS?.
Acutally above example is html data export to excel sheet. that mean that excel file created and saved your computer. What you want Please describe your problem.
Where will the Excel sheet be saved