Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It is straightforward to export lists to Excel with Export. Can I export a graphic image, too? This does not work:

g = CompleteGraph[4];
fnOut = "Output1.xls";
Export[fnOut, {"Sheet1" -> g}]

Maybe I need to transform g in some way?

share|improve this question
What do you want to see in Excel? An image or a Plot? – Dr. belisarius Jul 5 '12 at 17:54
Not sure what the difference is. I do not need details of the graphs such as coordinates of the vertices. And I do not need Excel's graphing capabilities. So, image, I suppose. – Karsten W. Jul 6 '12 at 16:33
up vote 10 down vote accepted

You can export both data and the images using one of several syntax patterns that you find in the docs on XLS format:

enter image description here enter image description here

For example:

 g = CompleteGraph[7];
 {g, {"mySheet1" -> Normal@AdjacencyMatrix[g]}}, {{"Images", "Sheets"}}]


enter image description here

EDIT: Exporting multiple images:

It seems you need at least one sheet (which could be empty) as part of any export. With this restriction,

Export["multipleImages.xls", {CompleteGraph[#] & /@ {5, 7, 9}, {}},
  {{"Images", "Sheets"}}]


Export["multipleImages2.xls", {{}}, "Images" -> (CompleteGraph[#] & /@ {5, 7, 9})] 


  {"Sheets" -> {}, "Images" -> (CompleteGraph[#] & /@ {5, 7, 9})}, "Rules"]

all work to export several images.

share|improve this answer
this is very helpful. Do you have an advice how to export several graphs in one Export statement? I studied the docs, but can not figure this out. – Karsten W. Jul 6 '12 at 16:31
@Karsten, I was not able to export only images (without at least one sheet accompanying the images), it seems you need at least one sheet (which could be empty) as part of any export. So, Export["multipleImages.xls", {CompleteGraph[#] & /@ {5, 7, 9}, {}}, {{"Images", "Sheets"}}] or Export["multipleImages2.xls", {{}}, "Images" -> (CompleteGraph[#] & /@ {5, 7, 9})] both work to export several graphs. – kglr Jul 6 '12 at 22:49
Great! I will try on Monday. – Karsten W. Jul 6 '12 at 23:07
aaaaand that puts you to 10k! Let the party begin! We now have 10 10k users – R. M. Jul 13 '12 at 23:56
@R.M Thank you again! – kglr Jul 14 '12 at 2:03

If you need a basic data behind the graph, the AdjacencyMatrix I think is good for tabular formats. This will work:

 Export["graph_data.xls", AdjacencyMatrix[CompleteGraph[13]]]


If you need the image of the graph object, in addition to programmatic way (see @kguler answer) there is an interactive way I personally use often. The steps (on win7):

  • Right click on a graph to copy it

enter image description here

  • In MS Excel open a drop-down under Paste, choose Paste Special and then choose Picture

enter image description here

share|improve this answer
I don't think this answers the question. The o/p clearly wanted to Export a graphic image to .xls, not manually import an image from Excel. And kguler's reply clearly proves the statement "... then you should export it as an image" wrong. I'd almost downvote. – Andreas Lauschke Jul 5 '12 at 20:36
@AndreasLauschke Yes kguler answer is cool, I updated my answer due to it. Nevertheless the interactive way I describe is something people often do not know. Some can benefit, as I did when I learned it. – Vitaliy Kaurov Jul 5 '12 at 21:23
An addition: the quality of EMF graphics always depends on the size on screen of the original image because metafiles are sampled at screen resolution fidelity (see my answer here). – Alexey Popkov Jul 6 '12 at 9:10
@AlexeyPopkov True. The easiest way is to drag the outer image frame to larger size if one does everything with the mouse anyway. – Vitaliy Kaurov Jul 6 '12 at 12:56
Thanks for the hint. Actually I want to export several graphs in one Export statement. – Karsten W. Jul 6 '12 at 16:35

Your Answer


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.