How do I import a table from excel in decent format ? I want to ask a question at MSE and import a table into my question. With decent I mean that it must look nice and not like a list or such. Maybe this is a duplicate, if so Im sorry.

  • 2
    $\begingroup$ What do you mean by a "decent" format? Where do you want to import the table to? $\endgroup$ – Ayman Hourieh Apr 3 '13 at 1:18
  • $\begingroup$ I edited, maybe that answers your question. $\endgroup$ – mick Apr 3 '13 at 11:08

For tables you can use array environment, see e.g. here or here.

Getting a table into MathJax is not necessarily very different from getting table into LaTeX document, so you might have a look at Comprehensive list of tools that simplify the generation of LaTeX tables on TeX.SE.

A minimalist solution would be to save table from excel to tab-delimited text and then replace tabs by & and end of lines by \ (or \\hline, if you prefer). This can be done, for example, using sed or some similar tool. Then you just add \begin{array}{|c|c|c|}...\end{array} manually.

For example the following worked for me (I use Sed port for Windows):
sed -f pom.sed input.txt > output.tex
The file pom.sed contains

s/  /\&/g

(The space in first line is in fact a tab character.)

Of course, there are many different tools, I would use this because I am used to working with sed. (It is useful for many different things I often use.)


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