I want to export a vector in Mathematica to appear as a column in Excel. I am trying

A={1, 2, 3}; 
Export["mfile.xls", {"A" -> A}]

But it is showing 1,2,3 in a row in the Excel file. I tried

Export["mfile.xls", {"A" -> Column[A]}]

But it is messed up as well. Any way to do this?



2 Answers 2

aA = {1, 2, 3};

Export["mfile2.xls", {"A" -> List/@ aA}]

enter image description here


Export["mfile2b.xls", {"A" -> Transpose@{aA}}]

enter image description here

see also this related Q/A: Problem exporting lists to Excel

  • $\begingroup$ Note the "A" here is the sheet name not the column ( "A" might not have been the best choice for the example.. ) $\endgroup$
    – george2079
    Sep 16, 2014 at 18:19
  • $\begingroup$ @george2079, i agree some other sheet name would have been better. $\endgroup$
    – kglr
    Sep 16, 2014 at 18:22
Export["C:\\YourPath\\test.xlsx", List /@ {1, 2, 3}]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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