Four ways to convert Excel tables to LaTeX

Gregor Gorjanc has a post on Excel and LaTeX that lists four ways to convert and Excel table into LaTeX. I’ve used two of the methods he lists: brute force and excel2latex. I recommend excel2latex. I used it frequently until I upgraded to Office 2007 and the plug-in quit working. The only bug I remember with it was that sometimes it would give you a warning saying it didn’t work, but it did; the LaTeX code you wanted was waiting for you on the Windows clipboard.

I plan to try out Gregor’s other two suggestions. Creating tables in Excel is far easier than doing so in LaTeX and I miss the functionality that excel2latex provided. Maybe there’s a way to use excel2latex with Excel 2007. If you know of a way, please leave a comment.

* * *

For daily tips on LaTeX and typography, follow @TeXtip on Twitter.

TeXtip logo

40 thoughts on “Four ways to convert Excel tables to LaTeX

  1. Hi there

    The best solution I’ve found so far is to copy the table to Gnumeric and then save the file as a .tex table fragment, works a treat!


  2. If you’re open to jumping over to the OpenOffice side of the fence, at least to export your data, you might try the calc2latex macro from the OpenOffice website here. It works very nicely and gives you basic formatting options.

  3. It works on Excel 2007 for me. After running the .xla file, the convert function can be found under the ‘Add-Ins’ tab, “Custom toolbars”.

  4. Just another user

    Works on Excel 2007 for me too. Just did exactly as Yun, and works like a charm!

  5. Did you guys do anything in particular? In which folder did you place the .xla file, for example? And did you try to convert from xls or xlsx files? Im’ getting a visual basic error: “compile error: cannot find project or library”. A visual basic screen is opened and the word “CurDir” is highlighted in the code. Did you guys have this problem?

  6. Hi
    I have the same problem getting the error: “compile error: cannot find project or library”. A visual basic screen is opened and the word “CurDir” is highlighted in the code.

  7. Anyone have any ideas on how to get excel2latex running on excel 2007? I’m having the same issue — installing it results in an icon appearing under ad-ins, but simply pressing it opens up a visual basics sheet or something with the compile error. Is there a step we are just missing?

  8. I just installed it to Excel 2007. Just put the ‘.xla’ file in any folder preferably the add-in folder under “C:Documents and Settings\Application DataMicrosoftAddIns” then open up Excel > Office Button > Excel Options > Add-ins > Go and select it from the menu that appears, or browse to the folder where you put it. That should give you a button under Add-ins in Excel which works fine. At least it works for me. I am running Win XP.

  9. Hi,
    For myself, having tried many aspects of excel2latex, and seeing that once a table is coded in Latex, it is very difficult to modify, I decided to do the following: I make a table in Excel, and format it the way I like, and then I just print it as a pdf file with pdf995, and then I add it to my Latex document as if it were a picture. Looks a bit less neat than real Latex tables though, but it’s the easiest way to do it I find.

  10. unfortunately, mac office does not support visual basic macros. i use the built-in concatenate function in excel. requires a few keystrokes, but this is the quickest i’ve found.

    =A1&” & “A2&”\”

  11. Alex is right, it helped! Thank you a lot!! Just remove the “missing” items from the list, as said in the link (provided by Alex).

  12. I’m using Excel2Latex with Excel 2007. It works fine, but I need to not only export the data, but clearify the commands used in Excel. For this, I would like to include coloumn and row headings, and export the cells as they are when the “show formulas” option is used. I can’t find an easy way to do this. Anybody know one?

  13. @rune
    The simplest solution, though not temporary, would be to:
    Use ‘search & replace’ ([CTRL]+H) and replace ‘=’ with ”=’ (add an apostrophe in front of the = ).
    But this will mess up your calculations since Excel will think that there is now only text…

  14. Yes, you can export tables from excel to LaTeX. Previously I had used excel2latex addon of excel to import selected tables in latex but I had to modify the LaTeX codes according to my requirement.

    Later, I accidentally came to know a beautiful GUI tool for importing excel tables to LaTeX and modifying the table according to the requirement in a What You See Is What You Get fashion. The tool is LaTable. Just simply select your excel table and paste it to LaTable. Then modify the table like bordering cell, merging horizontal cells, text alignment etc and then copy LaTeX code for table into your LaTeX editor. The details about it is given in my blog with pictures as well.
    Here’s the link

    I think LaTable is the best tool for you. 🙂

    With best regards,

  15. I am using Excel2Latex v3.0, I can save the selected excel tables to a .tex file, but I used “import content” in Scientific Work Place to import in the saved .tex file into a Beamer file. I was prompted “The marker ‘tab:addlabel’ occurs more than once in the document’.

    When I typeset, preview pdf file, there was a problem and it cannot proceed.
    I used Excel 2007.

    Could anyone kindly tell me how to solve the problem?
    Many thanks in advance

  16. Hi,

    I tried all above and I see the convert button. But when I click it says cannot run the macro? Any solutions?

    Best regards,

  17. Hi Alex,

    I’ve solved the problem. I changed the folder of the xla file and updated it three times : ) Now it works fine. Although the conversion is not always satisfactory.


  18. Am still having trouble with it myself. I have authorized macros to run, and I have loaded the file using Excel Options | Manage | Add-ins … and it says it is loaded.

    However, I do not get any menu tab which says “Add-ins” and so I don’t have access to the functionality.

    Any suggestions?

  19. Hi Ennis,

    which Excel version are you using?

    For Excel 2007 I found a workaround to access the add-in without using the add-in tab. Try to use the Quick Access Toolbar.
    Go to ‘Excel options | Customize’. In the pull down menu for ‘Choose commands from:’ select ‘All Commands’.
    In the list select ‘Custom Toolbars’ and then click ‘Add >>’.
    When closing the menu there SHOULD be a further button on your QAT. When you click it, there SHOULD be the Excel2Latex button.

    All without any guarantees. It works for me, but I got the Add in tab too 🙂

    This workaround is derived from here.

    Good Luck,

  20. Hi, The LaTable really works and I think it is the easiest way to do this work. 1-Just google to download the “LaTable download”
    2-Download the zip file and unzip it.
    3-Go to the LaTable folder.
    4.DOuble click on the LaTable.exe.
    5. Copy your table from the excel file.
    6.Don’t Don’t Don’t use ctrl+V……..use the edit option from the Latable window and click on the paste.
    7.Do your formatting as you wish on the LaTable file.
    8. Then go to edit option again and copy it by the option “copy as Latec code” and paste it to the latex file. Also write begin{table} & end{table}….before and after the pasted code.{Incase}
    9. It took 1 min to write the processor but it will not take more than 5 secs to generate the table in latex.


  21. Dear Ladies and Gentlemen :
    I exported table created by SPSS to excel then I converted ti Latex document. The table looks good ( in PDF) but there is an error message:
    ! Extra alignment tab has been changed to cr
    How can I remove the error ?
    Thank you

    K. Kuntoro

  22. Hi Kuntoro,

    It could be, that there are too many ‘&’s in a row of the table. Or that there isn’t a column format at the beginning of the table (begin{table}{ll}).
    Have you tried to zero in on the error by creating a minimal example?


  23. The method of opening in Open Office (v3.0.1 for me), and using the plugin Calc2Latex worked perfectly, with no hiccups!!!

    Download from here:
    double-click the file Calc2Latex.oxt – Open Office will ask you if you want to install it.
    Follow the instruction at the bottom of the page to use it – essentially, select the cells to convert; Go to Tools > Macro > Run…; Choose My macros>Calc2Latex>Calc2Latex>Main; Set the conversion options you want (eg. label, caption etc. etc.)

    Pretty Nice, saved me hours of work already… doesn’t appear to copy colors of cells though, but I haven’t run it more than once so far, so perhaps this is possible with more tinkering of the options.

  24. Hi,

    Can you please help me out how i have to copy the Excel spread sheet in to Word as a table format

  25. Have you heard of the package pgfplotstable? It is part of pgfplots and has a very good documentation. Pre- and post-processing and also typesetting of cell contents is very easy! All you have to do is to save your MS Excel/LibreOffice Calc sheet as a CSV and typeset it with pgfplotstabletypeset[col sep=comma, OTHER_OPTIONS]{PATH/TO/CSV_FILE}. I even succeeded doing pretty fancy tables spanning a couple of pages (package longtable) with colored rows (using package colortbl) and of course the rule commands of the package booktabs — all of these working together like a charm. 😉

  26. in excel : just add a column in excel full with “&” between each of the columns of your table and add another column full of “//” after the last column of your table
    in .tex: copy and paste the excel table into your .tex between begin{tabular} and end{tabular}
    and add format to your tabular as you wish!

  27. using R:
    save as csv, import into R as a dataframe using the function read.csv, use xtable to convert the dataframe into latex

  28. there are certain ways through which you can convert excel tables into latex. I have used excel2latex which easily converted. In ms excel 7 it doesn’t require as it provides the plugin to the add-in.

Leave a Reply

Your email address will not be published. Required fields are marked *