Excel-Addin for converting Excel tables to LaTeX tables

Although I am not a great fan of the Microsoft software, I have to admit that Excel is great. Sending tables from Excel to Word is easy but I work in LaTeX and then it can be time consuming. Fortunately there is a nice add-in for Excel that allows you to copy your Excel table to LaTeX. It is called Excel2LaTeX and developed by Joachim Marder and Andrew Hawryluk and can be downloaded from http://www.ctan.org/tex-archive/support/excel2latex/. I tested it with Excel 2010 and it works fine.
 
When you download the file Excel2LaTeX.xla you can either open it when you need it or if you use it often save it in your Excel add-in directory.
Most of the text formatting, border lines  and even multi-column cells are retained.
Text formatting (bold, italic) is retained and multi-column cells are supported. The LaTeX code can be copied to the clipboard or saved as a LaTeX file, which then can be included in an existing LaTeX document using the \input command.
 
Here a small example: First the excel table:
 
 
and here the code generated by Excel2LaTeX
 
% Table generated by Excel2LaTeX from sheet ‘Estimation LES’
\begin{table}[htbp]
\centering
\caption{Add caption}
  \begin{tabular}{rrrrrrr}
  \addlinespace
  \toprule
  {\bf } & \multicolumn{ 6}{|c}{{\bf from the Estimation}} \\
  \midrule
  {\bf Good} & {\bf Alpha} & {\bf Constant} & {\bf Number of hh} & {\bf R-Adjusted} & {\bf s.e. Alpha} & {\bf s.e. Constant} \\
  agr   & 0.01  & 68.79 & 8262  & 0.29  & 0.00  & 3.75 \\
  fd    & 0.03  & 329.83 & 8262  & 0.20  & 0.00  & 16.15 \\
  mnf   & 0.14  & -365.17 & 8262  & 0.67  & 0.01  & 52.49 \\
  ppp   & 0.01  & -16.51 & 8262  & 0.32  & 0.00  & 8.54 \\
  ene   & 0.03  & -26.40 & 8262  & 0.46  & 0.00  & 24.08 \\
  crp   & 0.02  & -45.15 & 8262  & 0.72  & 0.00  & 6.41 \\
  nmm   & 0.00  & -4.34 & 8262  & 0.29  & 0.00  & 1.51 \\
  \bottomrule
  \end{tabular}
\label{tab:addlabel}
\end{table}


And here the table in LaTeX (don’t  forget to include the package booktabs).

5 thoughts on “Excel-Addin for converting Excel tables to LaTeX tables

  1. You are correct. I don’t like fonts with serifs. I believe \renewcommand{\familydefault}{\sfdefault} does the trick.

  2. Is there a way to convert Latex table to Excel. I m using Textstudio in Latex machine

  3. Hi Jenisha
    I would copy and paste the lines of my table into Excel.
    Then I would choose Data – Text to Columns and choose & as delimiter
    As the last step, I would replace the line endings (\\) by an empty space using search-replace
    Hope this helps
    Renger

Leave a Reply

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

*