I have been trying to convert html table into csv format by jquery table2csv plugin. Table values are downloading as expected. But only in word format. I can't open it using excel. if i use .csv while downloading data showing in excel. Here is my jquery code
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="table2CSV.js" > </script>
<script type="text/javascript">
$(document).ready(function () {
$('table').each(function () {
var $table = $(this);
var $button = $("<button type='button'>");
$button.text("Export to spreadsheet");
$button.insertAfter($table);
$button.click(function () {
var csv = $table.table2CSV({
delivery: 'value'
});
window.location.href = 'data:text/csv;charset=UTF-8,'
+ encodeURIComponent(csv);
});
});
})
</script>