Export to Excel and CSV file - is not working
Export to Excel and CSV file - is not working
somasowmi@live.com
Posts: 6Questions: 2Answers: 0
I thought of using this ,
But having an issues in formatting when access from Germany machines. All got inserted into one column.
Try CSV and EXCEL from German machines ( IE - excel, All browser - csv)
https://datatables.net/extensions/buttons/examples/initialisation/export
This discussion has been closed.
Answers
Hi @somasowmi@live.com ,
There really isn't much for us to go on there, I'm afraid. We're happy to take a look, but it would help, as per the forum rules, if you could link to a running test case showing the issue so we can offer some help. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Link to a test case showing the problem:
Try to export CSV and EXCEL from German machines ( IE - excel, All browser - csv) form the below link,
https://datatables.net/extensions/buttons/examples/initialisation/export
I don't have a German machine, so if you want us to look at this, please can you provide a test case that we can run with steps on how to reproduce the problem.
Sure. It is a common issue to all German clients who is accessing from EUROPE. The** users from Germany are not able get the right format of data when they are using the option export to excel given in this website.**
I feel test environment from my end is not required as of now as the '''issue is persisting in your actual source still and could be reproduced at any German clients machine'''
_All the exported data has been dumped into one column instead of separating(,) it to more. _
Just use the below link from your website given for a demo to test this from any of the Germany base VM or by chaining the cultural settings of your local machine,
https://datatables.net/extensions/buttons/examples/initialisation/export
Test steps:
1. Login to any machine which is having internet connection and German cultural settings
2. Open the link https://datatables.net/extensions/buttons/examples/initialisation/export
3. Click the button "CSV" or "excel" given in this link https://datatables.net/forums/uploads/editor/fq/2ldvvdjo1pno.png
4. Open or Save and Open the exported file
5. The columns A should not be dumped with all the data instead it should spread to the respective columns as like in the table with headers
Thank you for your response Colin!
I've just changed it on my machine to use Microsoft's German language package and settings:
The example you link to on this site appears to work just fine.
How did you configure your own machine to test this?
Allan
Please change the setting like this and try again,
Is that Win 7 or 8? I was using 10 before. I've just tried in a Win 8.1 VM and it appears to work just as expected:
I know that the IE Excel export doesn't work at the moment. That's nothing to do with the localisation of the machine. Its a bug that has been fixed for the next release.
CSV appears to be just fine though.
Allan
Yes, we are widely using windows 10 and it is latest. It is not working from any of the browser with this above settings(Localization).
Could you please let me know from which version we could expect this will be working?
Thanks - I've just tried changing those specific settings in Win10 and I can indeed see the CSV collapsing down to a single column. Why that is I don't know. I've just run a
diff
on the DE locale exported file and an EN locale exported file and they are absolutely identical.Thus it must be related to how Excel is doing the CSV import for the DE locale. I can't see why that would make any different at all - a CSV file is locale independent.
I think this is something that would need to be reported to the Excel team.
Allan
Just encountered this issue myself, the problem is that .csv in europe do not use comma delimiters - because numbers there use comma as the decimal place. (e.g. € 334,78). I have to switch the delimiter to ; in the customize csv function, and then at line 1 of the csv file you can add
sep=;
and excel will figure it out automatically. All my numbers are still formatted as US with . so I'm not sure this will work if you still use comma in your numbers.@RobinS. that doesn't look right to me.
This is valid CSV, with a decimal comma:
This is how my european colleagues explained it to me - it's the comma delimiter itself that is not valid for them, even if it's a valid comma delimited csv (and even csv name itself implies comma delimited). It doesn't quite make sense to me either.
Just to add - I think the situation is more that their default delimiter in their excel regional settings is a semicolon.
The
csvHtml5
button type has afieldSeparator
option which defaults to be a comma, but you could use a tab or semi-colon (or anything else) if you prefer.I can absolutely see the point that using a comma separator could get confusing if you are using comma decimal places - too many commas. However, if the fields are correctly quoted like in @tangerine's example, it would still work.
CSV is a surprisingly tricky beast for what is meant to be a simple file format!
Allan
Alan, do we have an example of how to configure buttons with the use of fieldSeparator?
Borut
Here's an example for
copyHtml5
button, but the same would apply for CSV: https://datatables.net/extensions/buttons/examples/html5/tsv.htmlColin