I try to export two grid in a same xls file, naming the sheets. This is an exemplification of my issue, and it doesn't work.

m = Grid[Table[i - j, {i, 3}, {j, 4}]];
Export["m.xls", m]

it works correctly, but if I try this code, naming the sheet, it doesn't work

Export["m.xls", {"MySheet" -> m}]



1 Answer 1


The Grid is the reason why it does not work! Try this for multiple sheets

x = RandomReal[1, {5, 5}];
y = RandomInteger[{-10, 10}, {5, 5}];
Export[$UserBaseDirectory <> "\\file.xlsx", {"Real" -> y,"Integer" -> y}]

In your case

m=Table[i - j, {i, 3}, {j, 4}];
Export[$UserBaseDirectory <> "\\file.xlsx","MySheet" -> m]
  • $\begingroup$ Minor error the y and y in the Export should have been x and y $\endgroup$
    – Nigel King
    Apr 28, 2017 at 12:40

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.