'Excel data to the MySql database
I have already find this code and tried - it creates a DOM object from the copypasted textarea from Excel. The script:
<script>
function generateTable() {
var data = $('textarea[name=excel_data]').val();
console.log(data);
var rows = data.split("\n");
var table = $('<table class="table"/>');
for(var y in rows) {
var cells = rows[y].split("\t");
var row = $('<tr />');
for(var x in cells) {
row.append('<td>'+cells[x]+'</td>');
}
table.append(row);
}
// Insert into DOM
$('#excel_table').html(table);
}
</script>
The HTML:
<p>Paste excel data here:</p>
<textarea name="excel_data" class="form-control" id="exampleFormControlTextarea1" rows="10"></textarea><br>
<input type="button" onclick="javascript:generateTable()" value="Generate Table"/>
<br><br>
<p>Table data will appear below</p>
<hr>
<div id="excel_table"></div>
The problem is how to insert the data from table to Mysql database. Please help
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|