Writing a file from Mathematica for use by another program.
The output file will be a comma separated file.
Content of the file will be a combination of numbers and text.
The text in the output file should not have quotes around it.
Below is a sample data set and what I have tried so far.
row0 = {"h1", "h2", "h3", "h4", "h5", "h6"};
row1 = {"", "", "a1", 1.01, "", ""};
row2 = {"", "", "b1", 2.02, "", ""};
row3 = {"", "", "c1", 3.03, "", ""};
data = {row0, row1, row2, row3};
Export["data.csv", data];
Export["data.txt", data];
Export["data.dat", data];
Export["data.tsv", data];
Export["data.xls", data];
A summary of the results:
- data.csv – has quotes around the strings
- data.txt – has quotes around the strings and curly braces around each line
- data.dat – no quotes around the strings, but the data is separated by tabs
- data.tsv – has quotes around the strings
- data.xls – no quotes around strings, data in appropriate columns, but this is an Excel file, which can’t be read by the other program.
One successful work-around:: save the files as data.xls, then from Excel export to a .csv
Is there a way to Export the data so that it does not have quotes around the strings, but is separated by commas?
(Follow-up question: how to include quotes in some of the exported text. The Excel workaround fails for this case.)