export data to a CSV file properly

I tried to export data to a CSV but I have a little problem, because when I do it, the CSV saved is not correctly saved. (I use react-csv library)

I followed the guide from here and all the examples I found they basically do the same thing!

For example I have this data:

const csvData = [
  ["firstname", "lastname", "email"],
  ["Ahmed", "Tomi", "[email protected]"],
  ["Raed", "Labes", "[email protected]"],
  ["Yezzi", "Min l3b", "[email protected]"]

In order to export it they suggest me to do this:

<CSVLink data={csvData}>Download me</CSVLink>;

But if I do so the CSV saved looks like this:

enter image description here

As you can see the data is set only on one column.

Did I do something wrong?

Would you like to show me the correct way to do it? Actually everything I found uses the approach above.

Thank you very much!


There are two options while opening a CSV file in excel, I think you somehow choosed the option “fixed-width” which is a non-default option. If you can adjust that setting and still got the issue lmk.