TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. 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

I will be using Microsoft Excel to produce graphs and I was wondering if there was a simple way to put those graphs into a LaTeX document?

share|improve this question
You have to export the graphs to eps or pdf or jpg and then include them with \includegraphics{}. – Sigur Dec 28 '12 at 23:06
So I just save the graphic to .eps, .pdf or .jpg? I have heard that .png is the best file format to use? Is this right? – CAF Dec 28 '12 at 23:13
@CAF: No, PNG is a raster format, which means it is not scalable. PDF or EPS are much better. – Siyuan Ren Dec 29 '12 at 0:56
up vote 25 down vote accepted

You can put the graph as a seperate document tab (opposed to inside a sheet). Then you can print it to PDF, using either some installed PDF printer or the Office built-in PDF printer. Then you can include the graph using the package graphicx and the command \includegraphics[width=\linewidth]{graph.pdf}.

You can as well download the TeX fonts as OTF and use them in Office, achieving the font consistency. The basic Computer Modern can be gotten here in the renewed version Latin Modern:


share|improve this answer
Or use the data points and plot the graph using pgfplots or tikz. – Harish Kumar Dec 28 '12 at 23:11
@HarishKumar TBH, If I had to do it, and I had some calculations in Excel, I would prefer exporting the graphs, and would only care about the proper font family and eventually font size. – yo' Dec 28 '12 at 23:13
Where you say save to pdf, could I use png? I have heard this is the most reliable format. If so, why? – CAF Dec 28 '12 at 23:20
In this case, pdf is certainly better, because png is raster graphics, making it badly scalable. For this, you are safe with pdf because you don't use any special functions (hyperlinks, embedded videos or who-knows-what). – yo' Dec 28 '12 at 23:24
I have tried this code, but the following error message appears: 'The required file tex\context\base\supp-pdf.mkii is missing. It is part of the following package: mptopdf. The package will be installed from: (link to choose repository directory). It then allows an option to install, but I have clicked this and the exact same message appears again and again... Any ideas? – CAF Dec 29 '12 at 9:02

This is another solution if you have Visio. This is the explanation for Visio 2010.

Step 1. Copy and paste the graph. Copy/paste your Excel graph to Visio. Be sure that it is pasted as Microsoft Office Excel Worksheet (this should be the default, but it can be ensured using the Paste Special option instead of Paste).

Step 2. Remove blanks spaces around the graph. Go to Design tab, then find Page Setup, go to Size and choose Fit to Drawing. This removes everything but margins. To remove margins, open the Page Setup (click on the small icon in the bottom right corner of this ribbon area), go to Print Setup tab, click on Setup and set the margins (it seems that the left margin cannot be set to 0, at least not using this approach). Then click OK twice.

Step 3. Create the PDF file. Now go to File, then Save As, from the Save as type list choose PDF. Click Options, adjust the options, then click OK and finally Save. Now there should be the PDF file with the graph.

Step 4. Import this PDF file into a LaTeX document. For this, the \includegraphics command should be used.

share|improve this answer
Update. Similar can be achieved using Word. Just paste an Excel graph to Word as a graph (not a picture or a metafile). Then set margins to 0, change page size and save as PDF. – MSt Dec 30 '14 at 12:05

I wanted to add a very simple but effective way of how I was doing it. I was using Excel to graph results, because I didn't have that many graphs (much more tables). Nontheless I think the outcome is quite good and sufficient for many cases (exceptions would be if you needed to create a lot of graphs, then you might prefer other programs instead, like mathlab, or Latex packages to achieve a more consistent look with regard to captions).

First mark the graph/diagram and use file/save as...Here you must choose pdf-format. I would save the file in the same folder where you usually save all your tex-files.

The next step is to crop the image. There are numerous ways, e.g. Photoshop, IrfanView. A more professional, automated way would be pdfcrop. You need to download Perl first and install, then you can use it. A little warning: You need to use the command line for pdfcrop. The advantage is that you can very quickly crop all your images perfectly with little to no margins. There are many tutorials/explanations on these programs to find.

The final steps have been described before. You need to load the package graphicx and the command to insert a graph_x is \includegraphics[width=\linewidth]{graph_x.pdf}.

That's it :)

share|improve this answer

If you can switch to some other spreadsheet software, you can try one of those that support export to LaTeX: https://en.wikipedia.org/wiki/Comparison_of_spreadsheet_software

share|improve this answer
Does any of those support graphics? I would have assumed they only supported tabular material. – Torbjørn T. Nov 11 '13 at 14:29

In addition to what the other posters said it is worth mentioning that one can also use VBA code to create regular exports from Excel, quite helpful if you need to repeat the exports because the data have changed.

A while ago I wrote a blogpost on this, the following VBA code is taken from this post:

Sub ExportAllCharts()

    If ActiveSheet.ChartObjects.Count > 0 Then
        For Each Diagram In ActiveSheet.ChartObjects
            Filename = ActiveChart.Name
            ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
        "C:\" & Filename, Quality:=xlQualityStandard, _
        IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
        Next Diagram
    End If

End Sub
share|improve this answer
Is there something like this for libre office? – dani Jul 25 '15 at 12:12
I am not aware of it, but I can imagine... – Uwe Ziegenhagen Jul 25 '15 at 13:36

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.