Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

When I use the form Export["file", list, "Table"] to export a list to Excel, I get columns of lists. I want my Excel sheet to have each list element in a separate column.

For example,

Export["file.xls", {{2, 5}, {5, 7}}, "Table"]

Gives the output

{2,5}
{5,7}

I want those lists above to be split up. How do I do this?

share|improve this question
    
Flatten will get rid of the nesting and will give you one column. Not sure how to transpose it. Export["file.xls", Flatten@{{2, 5}, {5, 7}}, "Table"] –  brama Jul 8 at 21:17
    
There appears to be some confusion about the format of the desired output. Please provide a sample. –  brama Jul 8 at 22:27

2 Answers 2

Correct it to be:

Export["file.xls",{{2,5},{5,7}}]

or more explicitly

Export["file.xls",{{2,5},{5,7}},"XLS"]

"Table" is a generic Table-Format, suitable for a simple Text-Editor, not specially dedicated to Excel

When you leave away the 3rd argument, then the default value is "XLS", and Excel will import it without additional Import-Dialog.

share|improve this answer

Perhaps

tab = {{2, 5}, {5, 7}};
tab2 = List /@ # & /@ tab  (* or tab2 = Map[List,tab,{-1}] *)
(*  {{{2},{5}},{{5},{7}}} *)
Export["fileA.xls", tab2]

enter image description here

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.