5
$\begingroup$

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?

John

$\endgroup$
3
$\begingroup$
aA = {1, 2, 3};

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

enter image description here

or

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

enter image description here

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

$\endgroup$
  • $\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 '14 at 18:19
  • $\begingroup$ @george2079, i agree some other sheet name would have been better. $\endgroup$ – kglr Sep 16 '14 at 18:22
1
$\begingroup$
Export["C:\\YourPath\\test.xlsx", List /@ {1, 2, 3}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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