12

I have a big LaTeX table that I want modify it in Excel, is there any solution?

There is some good solutions for converting Excel table to Latex tables.

7
  • 4
    You can use CSV files and set up it to use & as the values separators.
    – Sigur
    Apr 4, 2013 at 16:33
  • 3
    excel2latex. I only know that it exist, never used it. Apr 4, 2013 at 16:38
  • 1
    Have a look at datatool. what kind of modification in excel that it cannot be done in latex itself? Apr 4, 2013 at 16:40
  • 1
    See also tex.stackexchange.com/questions/49414/… Apr 4, 2013 at 16:41
  • @Sigur Thanks. My table is not so simple, it contains merged cells and indeed I want change the merging style. Apr 4, 2013 at 16:51

3 Answers 3

10

You can import a latex table into excel.

  1. In the excel main menu select File -> import ...
  2. choose csv or text as file type
  3. choose "&" as your delimiter (un-select all others)
  4. finish
7

As far as I know there exists no solution you want, even if you want to merge cells.

The only thing that exists is excel2latex, but I never saw a result of this Excel macro that has not to be reworked.

Perhaps a pretty printing of your table could help you. For example write all & below each other so you can see the columns of your table in your tex file.

For example:

\begin{tabular}{r@{:}l*{5}c}
\toprule
\multicolumn{1}{c}{}    &       & \multicolumn{5}{c}{Node ID}                     \\ 
\cmidrule{3-7}
\multicolumn{2}{c}{Date | Time} & 25             & 28             & 29             & 31              & 32              \\
\midrule
9/29/2007 00            &00     & \ding{108}     & \ding{108}     & \ding{108}     & \ding{108}      & \ding{108}      \\
9/29/2007 01            &00     & \ding{109}     & \ding{109}     & \ding{109}     & \ding{109}      & \ding{109}      \\
9/29/2007 23            &00     & \ding{108}     & \ding{108}     & \ding{109}     & \ding{108}      & \ding{109}      \\
\midrule
9/29/2007 23            &00     & \textbullet    & \textbullet    & \textbullet    & \textopenbullet & \textopenbullet \\
\midrule
9/29/2007 23            &00     & $\blacksquare$ & $\blacksquare$ & $\blacksquare$ & $\square$       & $\square$       \\
\bottomrule
\end{tabular}

In this was you can easy see the columns of your table and you can change the mergin style by inserting \multicolumn. The bad example would be something like this:

\begin{tabular}{r@{:}l*{5}c}
\toprule
\multicolumn{1}{c}{} & & \multicolumn{5}{c}{Node ID} \\ \cmidrule{3-7}
\multicolumn{2}{c}{Date | Time} & 25 & 28 & 29 & 31 & 32 \\ \midrule
9/29/2007 00&00 & \ding{108} & \ding{108} & \ding{108} & \ding{108} & \ding{108} \\
9/29/2007 01&00 & \ding{109} & \ding{109} & \ding{109} & \ding{109} & \ding{109} \\
9/29/2007 23&00 & \ding{108} & \ding{108} & \ding{109} & \ding{108} & \ding{109} \\ \midrule
9/29/2007 23&00 & \textbullet & \textbullet & \textbullet & \textopenbullet & \textopenbullet \\ \midrule
9/29/2007 23&00 & $\blacksquare$ & $\blacksquare$ & $\blacksquare$ & $\square$ & $\square$ \\ \bottomrule
\end{tabular}
6
  • Thank, Is there any tex editor that could prettify the code? IDEs could to that for most programming languages.What about LaTeX? Apr 4, 2013 at 17:16
  • 1
    In Emacs (use AUCTeX for serious business) you can use align-current which works fairly well. Apr 4, 2013 at 17:24
  • @PHPst for vim read the section “tabular” in this answer. Apr 4, 2013 at 17:35
  • Gnumeric is able to export table to LaTeX via Save As command.
    – g.kov
    Apr 4, 2013 at 18:52
  • @PHPst: For prettyfing latex code: github.com/cmhughes/latexindent.plx
    – user11232
    Apr 4, 2013 at 22:36
1

I wrote a script that does exactly that. It can be used with multicolumns, multirows and supports booktabs package. (in fact, I only implemented it for booktabs, but implementation for normal hline is just a matter of minutes.) It will create one worksheet for each table.

Usage: python tex2excel YOUR_INPUT_LATEX_FILE OUTPUT_EXCEL_NAME

I know this is a late answer, but hopefully it could help future people from google. click here for the code

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .