1

May i know how to press a button and download an excel(.xlsx), the excel will need to contain all the values. Some of the table is an input, need to download the input value.

My html code look like this:

<table id="tabledata" border=1>
<tr><td>X</td><td>Y</td><td></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX1"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY1"></td><td><button onclick="remove(1)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX2"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY2"></td><td><button onclick="remove(2)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX3"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY3"></td><td><button onclick="remove(3)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX4"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY4"></td><td><button onclick="remove(4)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX5"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY5"></td><td><button onclick="remove(5)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX6"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY6"></td><td><button onclick="remove(6)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX7"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY7"></td><td><button onclick="remove(7)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX8"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY8"></td><td><button onclick="remove(8)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX9"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY9"></td><td><button onclick="remove(9)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX10"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY10"></td><td><button onclick="remove(10")>Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX11"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY11"></td><td><button onclick="remove(11)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX12"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY12"></td><td><button onclick="remove(12)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX13"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY13"></td><td><button onclick="remove(13)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text" onkeyup="" id="dataX14"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY14"></td><td><button onclick="remove(14)">Remove</button></td></tr>
<tr><td class="tabledatacell"><input type="text"onkeyup=""  id="dataX15"></td><td class="tabledatacell"><input type="text" onkeyup="" id="dataY15"></td><td><button onclick="remove(15)">Remove</button></td></tr>
</table>
</td></tr>
</table>
3
  • Is this a solution for you:stackoverflow.com/questions/17142427/… Commented Feb 6, 2020 at 7:31
  • @marcelo when i download press the export button it download a non-excel file. Commented Feb 6, 2020 at 7:46
  • does this code work and if does where do i insert this code? filename = filename?filename+'.xls':'excel_data.xls'; Commented Feb 6, 2020 at 7:47

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.