Export CSV fieldSeparator bug?
Export CSV fieldSeparator bug?
![Tahir wiguna](https://secure.gravatar.com/avatar/a0315966d448b081fb6773ecd42363a9/?default=https%3A%2F%2Fvanillicon.com%2Fa0315966d448b081fb6773ecd42363a9_200.png&rating=g&size=120)
I'm trying to make an export CSV button and the separator default is "comma" and I'm trying to change it to semicolon but it broke the CSV. the result when i export it is like this.
but if i change to different symbol or alphabet it works fine, here is my code
function InitDatatableAtt(){
var buttons = [
{
extend: 'csvHtml5',
text: 'Export CSV',
fieldBoundary: '',
fieldSeparator: ';'
},
];
var table = $('#dttable_att').DataTable({
"order": [0,"desc"],
"lengthChange":false,
"dom": 'Bfrtip',
"buttons": buttons
});
}
This question has accepted answers - jump to:
This discussion has been closed.
Answers
Using your code seems to work good in this example:
http://live.datatables.net/ropavoha/1/edit
Does the CSV file look correct if you open in a text editor instead of a spreadsheet?
Please provide a test case or update mine to show the issue.
Kevin
Ummm... not for me here is the result of your code.
![](https://datatables.net/forums/uploads/editor/am/gu90yx33vfn8.png)
so why it looks like that?
is there something that i need to setting?
thanks for replying me![:) :)](https://datatables.net/forums/resources/emoji/smile.png)
oops sorry i dont see your question,
yes it is fine on text editor but my client want to open it on excel
A CSV file is a text file not a spreadsheet file. Open the file in a text editor to view it. Are you wanting to open the file in a spreadsheet or something else?
Kevin
Wow! thanks for the info bro
. but it is possible to open it in spreadsheet?
Is Excel the spreedsheet you are using? If so change the button type to Excel. You will also need to have JSZip.js which you can get from the Download Builder.
Kevin
Wow, it works! Thanks man![<3 <3](https://datatables.net/forums/resources/emoji/heart.png)
Do you mean the
#######
in place of a date? Excel will show that if it doesn't have space to render a date field. You could make the column wider in Excel. Or as Kevin says, use the Excel export which does automatic column width adjustment in the created file (not possible in a plain CSV file).Allan