Take the 2-minute tour ×
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.

Manually hacking tables in LaTeX is one of the less funny things when preparing a document. Naturally, there are quite a few tools that promise to simplify this. In fact, I have somewhat lost track of all the tools available, and I'd like to gather your valuable experience into one big post. Some of the tools are mentioned in Tool for manipulating LaTeX tables (HTML to LaTeX), but I feel there's much more around.

I'd suggest that somebody starts an overview with an alphabetic list (so that I can accept this answer and it stays on top), and that everyone replies with a "community wiki" entry, one reply per tool, and inserts the tool into the list.

Personally, I use Excel2LaTeX, but I'm unhappy with having to fire up Windows in order to generate the LaTeX code. I'm thinking of a rewrite as a standalone Python tool using the xlrd library, but I'm not too inclined to reinvent the wheel.

share|improve this question
    
What, precisely, do you want to achieve with tables? I mean, do you need to format numbers / dates? Do you have repeative tasks in the form of numerical post-processing? Or do you need flexible typesetting (multicolumn/multirow/formatting/typesetting)? What is it that you are missing? auto-alternating colored rows? Or do you need WYSIWYG editing? –  Christian Feuersänger Mar 25 '12 at 19:26
2  
Yes to all questions :-) No, honestly. Anything that will take input data and produce \begin{tabular}...\end{tabular} with something sensible inside is welcome here. I'm not asking for how to produce this-and-that output in LaTeX, I guess this has been covered enough on TeX.SX and elsewhere. –  krlmlr Mar 25 '12 at 19:37
2  
Not a tool as such, but it may be worthwhile to consider simpler layouts in general -- lots of difficulty arises from trying to reproduce a particular Excel format, when that format would go against many typographical guidelines (e.g., you really don't want that table with the double vertical rules, the borders around each cell, ...) –  Mike Renfro Mar 25 '12 at 23:26
    
@MikeRenfro: I totally agree, in most cases you want what booktabs provides. However, sometimes these tableaux (as the booktabs documentation calls tables with inter-cell rules) are useful. –  krlmlr Mar 26 '12 at 0:24
1  
This question has already a very good answer concerning the available table packages: tex.stackexchange.com/questions/12672/…. –  Legolas Mar 26 '12 at 6:52

22 Answers 22

Orgtbl-minor-mode (for emacs)

This is along the lines of this answer about org-mode. org-mode also provides a minor mode designed specifically to typeset tables with the org syntax, but in a non-org buffer.

Latex is supported out of the box, and there is a tutorial in the org manual.

Pros

  • all those in the answer about org-mode
  • no need to use a separate buffer or mode, all is done in the latex buffer
  • the exporter can be set up on a per-table basis, simply passing parameters to the #+ORGTBL line

Cons

  • the emacs learning curve, mentioned in the answer about org-mode
  • you do not get a full-featured org buffer, which means some keybindings will not be available if they clash with the latex keymap
  • you will also miss on some features of the org swiss-army-knife, for example, the ability to generate the table values from the org buffer, with embedded scripts or code snippets.

For the impatient, though already familiar with org-mode people:

  • turn the minor mode on: M-x orgtbl-mode RET
  • create the template: M-x orgtbl-insert-radio-table RET

enter image description here

  • fill the table

enter image description here

  • export the table: C-c C-c

enter image description here

The two approaches (org and orgtbl) are different in purpose, in my view. org-mode is fine if you don't need to change your data a lot, or if you can afford to do the manual tweaking after every export.

On the other hand, with orgtbl, you can change your table, reexport and recompile in a few keystrokes. It also provides some ways to "automate" the tweaking, but they are still more or less dirty hacks: it goes from overwriting parameters in the export function (which is fine, I guess) to injecting latex code in the cells (for example additional line space can be added in the first cell of the next line).

share|improve this answer

Inlage

Insert → Insert Table (Ctrl + Shift + T ) will open the following window (where I have filled some data):

enter image description here

Upon pressing insert, the code is inserted in the editor where the cursor is:

enter image description here


Importing from Excel

Let us say we have an excel table with formulae:

enter image description here

Select the values and copy:

enter image description here

Now paste in the inlage editor (directly). The Insert Table window will appear as shown below:

enter image description here

Press the Insert button after editing if any. Values will be converted in to LaTeX code as shown below:

enter image description here

share|improve this answer

AppleScript Excel2Latex

I wrote this AppleScript to help me convert my selection in Microsoft Excel 2011 Mac to LateX code. I have it configured to export into a longtabutable, but it can easily be configured to accommodate other needs.

Limitations: Script ignores bold or italicized words

(*
Must have \usepackage{longtable} and \usepackage{tabu} in preamble.
Export is saved to Desktop as "Excel Table Export.tex"
written in 2013 by Jonathan Komar
*)

set target_file to (((path to desktop folder) as text) & "Excel Table Export.tex")
my write_to_file("", target_file, false)

tell application "Microsoft Excel"
    set mySel to selection
    tell selection to set {rowCount, columnCount} to {count rows, count columns}

    set columnsList to {}
    repeat columnCount times
        set end of columnsList to "X[m] "
    end repeat

    set myList to {}

    set writeThis to "\\begin{longtabu}{ " & (columnsList as string) & "}\n\\tabucline[.4mm,black]1\n"
    my write_to_file(writeThis, target_file, true)
    repeat with rowStep from 1 to (rowCount)
        repeat with columnStep from 1 to (columnCount)
            set currentValue to value of cell columnStep of row rowStep of mySel
            if columnStep is equal to columnCount and rowStep is 1 then
                set writeThis to currentValue & "\\\\\n\\tabucline[.05mm,black]1\n"
                my write_to_file(writeThis, target_file, true)
            else
                if columnStep is not equal to columnCount then
                    set writeThis to currentValue & " & "
                    my write_to_file(writeThis, target_file, true)
                else
                    set writeThis to currentValue & "\\\\\n"
                    my write_to_file(writeThis, target_file, true)
                end if
            end if
            if rowStep is equal to rowCount and columnStep is columnCount then
                set writeThis to "\\tabucline[.4mm,black]1\n\\end{longtabu}"
                my write_to_file(writeThis, target_file, true)
            end if
        end repeat
    end repeat
end tell

return myList as string



on write_to_file(this_data, target_file, append_data) -- (string, file path as string, boolean)
    try
        set the target_file to the target_file as text
        set the open_target_file to ¬
            open for access file target_file with write permission
        if append_data is false then ¬
            set eof of the open_target_file to 0
        write this_data to the open_target_file starting at eof as «class utf8»
        close access the open_target_file
        return true
    on error
        try
            close access file target_file
        end try
        return false
    end try
end write_to_file

AppleScript Numbers2LateX

This is a template script for iWork Numbers. It has issues: You need to set the rows and columns in the script manually or by adjusting the table to fit your content. I am not sure how to get a row and column count of a selection in Numbers. Warning: This script does not seem to work as well as the excel script. It must be improved!

(*
Must have \usepackage{longtable} in preamble.
Export is saved to Desktop as "Numbers Table Export.tex"
written in 2013 by Jonathan Komar
*)

set target_file to (((path to desktop folder) as text) & "Numbers Table Export.tex")
my write_to_file("", target_file, false)

tell application "Numbers"
    set rowCount to (get row count of table 1 of sheet 1 of document 1)
    set columnCount to (get row count of table 1 of sheet 1 of document 1)

    tell front document
        tell table 1 of sheet 1
            set columnsList to {}
            repeat columnCount times
                set end of columnsList to "X[m] "
            end repeat

            set myList to {}
            set writeThis to "\\begin{longtabu}{ " & (columnsList as string) & "}\n\\tabucline[.4mm,black]1\n"
            my write_to_file(writeThis, target_file, true)
            repeat with rowStep from 1 to rowCount
                repeat with columnStep from 1 to (columnCount - 1)
                    set currentValue to value of cell rowStep of column columnStep
                    if columnStep is equal to columnCount and rowStep is 1 then
                        set writeThis to currentValue & "\\\\\n\\tabucline[.05mm,black]1\n"
                        my write_to_file(writeThis, target_file, true)
                    else
                        if columnStep is not equal to columnCount then
                            set writeThis to currentValue & " & "
                            my write_to_file(writeThis, target_file, true)
                        else
                            set writeThis to currentValue & "\\\\\n"
                            my write_to_file(writeThis, target_file, true)
                        end if
                    end if
                    if rowStep is equal to rowCount and columnStep is columnCount then
                        set writeThis to "\\tabucline[.4mm,black]1\n\\end{longtabu}"
                        my write_to_file(writeThis, target_file, true)
                    end if
                end repeat
            end repeat
            get value of cell 1 of column 2

        end tell
    end tell
end tell



on write_to_file(this_data, target_file, append_data) -- (string, file path as string, boolean)
    try
        set the target_file to the target_file as text
        set the open_target_file to ¬
            open for access file target_file with write permission
        if append_data is false then ¬
            set eof of the open_target_file to 0
        write this_data to the open_target_file starting at eof as «class utf8»
        close access the open_target_file
        return true
    on error
        try
            close access file target_file
        end try
        return false
    end try
end write_to_file
share|improve this answer

excel2latex.js

An online tool that converts .xlsx files (but no .xls files) to LaTeX tables. JavaScript based. The code is on GitHub. Haven't tested it yet, just found this answer.

share|improve this answer

Cals

The CALS table model is the historic precursor of the HTML table model. It is easier in use and offers more capabilities than tabularx.

Using the cals package, one can define tables in CALS syntax immediately in LaTeX.

Here is the documentation:

and an example:

\documentclass{article}

%text symbols
\usepackage{textcomp}

%table
\usepackage{cals}

\begin{document}
\makeatletter
\begin{calstable}
\colwidths{{12mm}{18mm}{18mm}{12mm}{15mm}}
\def\cals@cs@width{0pt} %no vertical lines
\setlength{\cals@paddingT}{3pt}
\setlength{\cals@paddingB}{2pt}
\alignC
\thead{\brow \cell{sectie} \cell{$D_{out}$\,(m)} \cell{$D_{in}$\,(m)} \cell{$\ell$\,(m)} \cell{$A$\,(m\texttwosuperior)} \erow}
\brow \cell{1} \cell{0,060} \cell{0,056} \cell{1,80} \cell{0,66} \erow
\brow \cell{2} \cell{0,055} \cell{0,051} \cell{1,80} \cell{0,60} \erow
\brow \cell{3} \cell{0,050} \cell{0,046} \cell{1,80} \cell{0,54} \erow
\brow \cell{4} \cell{0,045} \cell{0,041} \cell{1,80} \cell{0,49} \erow
\brow \cell{5} \cell{0,040} \cell{0,036} \cell{1,80} \cell{0,43} \erow
\brow \cell{6} \cell{0,035} \cell{0,031} \cell{1,80} \cell{0,37} \erow
\tfoot{\brow \alignR \nullcell{ltb} \nullcell{tb} \nullcell{tb} \nullcell{tbr} \spancontent{Totaal:} \alignC \cell{3,09} \erow}
\end{calstable}
\makeatother
De totale oppervlakte bedraagt 3,09\,m\texttwosuperior.
\end{document}

enter image description here

share|improve this answer
    
From the manual of the cals package: "The TeX code for tables is supposed to be generated automatically." Which tools generate TeX code in this particular syntax? –  krlmlr Jun 21 '13 at 9:00
    
erm... isn't this about XML-style CALS? –  krlmlr Jun 21 '13 at 10:00
    
@krlmlr The so far only tool which generates TeX in this syntax by interpreting XML CALS tables is unfortunately not released to public. Perfectionism is sometimes bad. –  olpa Jun 21 '13 at 13:40
    
@olpa: Thanks for the cals package, it looks like a sweet option. Why don't you also push your tool to GitHub, in whatever state it is? Then we'd only have to find a way to convert spreadsheet or R tables to XML CALS... –  krlmlr Jun 21 '13 at 13:49
    
@krlmlr A part of the tool is here. cals.py splits multirow and multicolumn cells to simple cells with annotations, which make xslt code very easy. I'll try to commit the xslt part in a few days. –  olpa Jun 22 '13 at 20:48

Gnumeric

My prefered solution.

EDIT:

  • You can save the spreadsheet as a full *.tex document (or one which can be "inserted" into an existing one, instructions for this are given as % comments %).
  • Alternatively, (my personal preference) gnumeric allows you to save the spreadsheet as a "table fragment" which will simply give you the plain-vanilla TeX-table :)

See http://projects.gnome.org/gnumeric/doc/file-format-latex.shtml for some further details.

enter image description here

share|improve this answer
2  
Would you be able to provide a little more detail. Perhaps an example of how this you do this? Even though you have low reputation, please upload images as well; remove the preceding !, which will be re-inserted by users with edit privileges. –  Werner Apr 18 '12 at 14:03
    
For anyone trying to find Gnumeric's Export menu, it's in the Data menu: Data, Export data, "Export into other format" –  OJW Oct 1 '13 at 17:57

LyX

LyX has a relatively decent table editor. By selecting View->View Source, one can directly see the resulting LaTeX code and easily copy&paste (and also learn) it from there. Furthermore, it is easy to typeset the result via LaTeX to get an impression on the actual look of the table. Other benefits are built-in support for booktabs and longtable.

enter image description here

The immediate representation of the resulting LaTeX source helped me a lot to actually learn the whistles and bells about LaTeX tabulars. Today I am fluent enough to use LyX only very seldom for this purpose.

share|improve this answer

Kile

http://docs.kde.org/stable/en/extragear-office/kile/wizard_array.html

enter image description here

http://docs.kde.org/stable/en/extragear-office/kile/wizard_array.html

Arrays and tabulars

One of the most boring jobs one can do in LATEX is to write a matrix or a tabular environment. One has to keep track of all the elements, ensure that the environment is well formed, and that all things are where they are supposed to be. Good indentation helps, but there is a simpler way: using Kile's Wizard → Array or Wizard → Tabular menu entries. You will then have a matrix-formed input form that you can easily fill in with your entries. This dialog also offers some options to typeset the tabular material.

share|improve this answer
    
It seems buggy though; I prefer exporting the raw table via gnumeric! –  nutty about natty Apr 13 '13 at 17:36

As you know you can also get a snapshot of your table and add the image file to your file. OK, OK! you are right this is not a good solution for all cases but use it as last resort. In such situation http://getgreenshot.org/ is your assistant.

share|improve this answer
    
If screenshots are your thing (which they shouldn't be, ew ;)) the default snipping tool in windows is easier to use. (At the time of writing, the linked seems to be a windows-only tool.) –  Sean Allred Aug 1 '13 at 0:12
    
You'd have to be desperate. If you have a vector image file (pdf) there are better ways than that, it's really only suitable when you only have an image of the table, then I would say retype it. –  Chris H Aug 5 '13 at 15:01

Emacs align-current and rectangles

OK, this isn't really much of an answer, but if you already have a table in LaTeX and you just want to edit it a bit, it can get a bit messy. If you use emacs then the following tools are super helpful.

First, align-current tries to line up your &s so that your data is more or less in columns. You can then use emacs' C-x r k to cut rectangles out, and C-x r y to paste rectangles back into your table.

Here are some links:

share|improve this answer
    
Not sure if the links cover this (I am on my phone now) but I had to change my font to be monospaced before The tools you mentioned could actually work for me. –  Vivi Dec 20 '12 at 9:20

Excel2LaTeX

An Excel add-in that converts parts of a spreadsheet into equivalent LaTeX tables.

Free.

http://www.ctan.org/tex-archive/support/excel2latex/

Pros

  • Supports and converts various formatting options:

    • bold/italics
    • alignment
    • cell spanning (horizontal/vertical)
    • struts
    • rotation of cell contents
    • cell border lines
    • booktabs option
  • Configurable: Repeatedly convert the same ranges with one click

Cons

  • Requires Windows or MacOS, and Excel to do the conversion

Disclaimer: I am the current maintainer of this add-in.

share|improve this answer
    
The small package "abstract" states that works up to Excel 2010. Do you happen to know if this support is also available for Excel 2013? –  Mario S. E. May 18 at 23:22
    
I think it should work in Excel 2013, too. If not, please file a bug. –  krlmlr May 19 at 12:46
    
It works perfectly :) –  Mario S. E. May 21 at 21:02

Did someone miss:

tablas

enter image description here

Some dummy text to fill...

share|improve this answer
    
LaTable has been mentioned. –  krlmlr Nov 5 '12 at 9:10
    
@user946850: I think I missed!. Removed. –  Harish Kumar Nov 5 '12 at 12:16

Direct spreadsheet editing

I've been handling data tables from Excel into LaTeX for lab reports for some while and I have tried several tools. I would like to make the case that unless you consistently require formatting of the same style, then quite often the simplest answer is to direct copy-paste from your spreadsheet into LaTeX with inserted columns including whatever separators you want.

This is particularly useful if you need extra mark-up between columns, such as $ ... $ signs or extra mathematical stuff such as units and the like.

This is arguably best for producing tableaux rather than formal scientific tables, and it does have the disadvantage that it inextricably links up data and formatting. On the other hand, that gives you a lot of freedom for data-dependent formatting. My most recent use of this was the following table, for my dissertation:

enter image description here

I can really not think of other ways of doing this - and particularly of ways that would later on enable me to easily change one of the functions displayed. This is of course not a scientific table, but this tableau is I think the clearest such presentation of these functions. (Spreadsheet and source code available on request.)

share|improve this answer
5  
Sorry, but I just not understand your approach. Maybe you could clarify how exactly you direct copy-paste from your spreadsheet into LaTeX? –  Daniel Nov 5 '12 at 8:53
1  
On Excel, simply select all the cells you want and hit ctrl+C, then paste into the LaTeX file. This needs every other column to contain a separator, starting from & or fancier if needed. For the table above an example separator is =CONCATENATE("} & \cellcolor{color",TEXT(L5,"0"),"} \textcolor{text",TEXT(L5,"0"),"}{") –  episanty Nov 5 '12 at 14:06
2  
That sounds like a really interesting approach! Maybe you could improve your answer by elaborating on this in more detail and provide a complete MWE? –  Daniel Nov 5 '12 at 15:11
    
An off-topic comment: Those "minus" signs in your headers and first columns are dashes, rather than real minus signs (you probably wrote -xxx instead of $-xxx$)... Remember to use the appropriate one for your reports/papers/etc. ! –  YuppieNetworking Feb 19 '13 at 11:32
1  
I hadn't thought of using this approach for table generation, but using excel as a line-based string-handling tool is a handy trick (creating batch files to apply complex renaming rules for example) –  Chris H Aug 5 '13 at 14:57

Calc2LaTeX

For the sake of completeness: You know, there is the spreadsheet programm of the OpenOffice / LibreOffice suite, simply called »calc«. It runs on Linux, Windows and probably on Mac, and it imports Excel spreadsheets quite nicely, if you haven't done more than using tables.

From calc to LaTeX there is an add to calc: calc2Latex

Works nicely, I've been using it for years.

share|improve this answer

R + xtable package

R has the package xtable which generates LaTeX output - useful if you want R results in tabular form. This is an easy way if you're working in the R environment anyway.

Free.

Pros

  • At least the following table types can be converted to a nice table out of the box:

    • One-way and two-way cross tabulations
    • Data frames
    • Model estimation results

    (Anyone more familiar with xtable please append to this list.)

  • Support for booktabs and longtable

  • Optional enclosing in table environment with caption
  • Formatting of numbers and cell contents can be specified
  • Optional filtering ("sanitizing") of TeX special characters
  • More flexibility in conjunction with knitr/Sweave: The definition of the table can be "plain" LaTeX code, and the contents can be generated by an R chunk

Cons

See also the following question for details on using xtable:

How can I use a table generated by R in LaTeX?

The Hmisc package can also generate tabular output from R.

share|improve this answer
2  
I would absolutely recommend this path, but only if you already are in the R environment and if you are creating a more or less "standard" table. Feeding data into R just to produce a (complicated) LaTeX table is possible, but then you might want to consider one of the other options listed here. –  krlmlr May 23 '12 at 8:33

csv2latex

For Mac users there is the script csv2latex which allows you to cut and paste spreadsheet cells from Excel, Number or Calc and paste them into your LaTeX source in a variety of popular table formats.

If you use TeXShop as your editor, this functionality is built into the program: there is a Paste Spreadsheet Cells macro in the Macros menu. For other Applescript-aware Mac editors, you can install the script manually.

Disclaimer: I am the author.

share|improve this answer

LaTable

A visual editor for LaTeX tables for Windows and Macintosh. It can be downloaded from CTAN.

The application provides a spreadsheet-like interface with the ability to insert and delete rows and columns, to edit the cells and to set the borders. Tables can be im- and exported as plain text or CSV files or saved in LaTable's own file format .latbl.

A (rather horribly-looking) example:

screenshot of LaTable with an example table

The code generated for this example table:

\begin{tabular}{l|ll|l}
\cline{3-3}
first column & \multicolumn{1}{l|}{second column} & third column & fourth column \\ 
\hline
\multicolumn{1}{c|}{1} & \multicolumn{1}{l|}{2} & 3 & 4 \\ 
\cline{3-3}
5 & 6 & \multicolumn{1}{r}{7} & 8 \\ 
\cline{1-2}\cline{4-4}
9 & \multicolumn{1}{c}{10} & 11 & \multicolumn{1}{l|}{12} \\ 
\cline{4-4}
\end{tabular}

And this is the compiled LaTeX result for comparison:

typeset LaTeX output for the above table

share|improve this answer
2  
The Mac version seems to fail on Snow Leopard. Did anyone tried it with another OS X? –  Tobi May 25 '12 at 22:49
    
Thanks for the app. I will be very more fantastic if it could merge cells on a column too. –  PHPst Apr 4 '13 at 17:18
    
At Mountain Lion, the app doesn't start. Some error message, but crashes before I can read it. –  trmdttr May 20 '13 at 12:16
    
@trmdttr record your screen with QuickTime and scan through. It might be dependent on Rosetta, which was discontinued with lion. :'( –  Sean Allred Jun 22 '13 at 23:00

Warning: what's below is more of a tongue-in-cheek answer, but not without a shred of truth in it!

\halign & \valign

Pro

  • It's what you'd eventually get with the other packages (most likely) anyways
  • format agnostic – it's a TeX primitive
  • Once you grok it, you'll be able to produce typographically beautiful tables more easily, and, on the other hand,
  • creating typographically ugly tables is difficult

Contra

  • there's a learning curve
  • creating typographically ugly tables is difficult ;-)

To expand a little, to think about what one is doing when inputting tabular data is that, if, for example, one is working on a spreadsheet program, what you are mentally doing is that every time you want to express that you want to move on to the next horizontal cell you press tab, and every time you want to move to the next row you press enter.

Now, if you just input & instead of tab, and \cr instead of enter, you can skip all the intermediary steps. That is, converting the spreadsheet program generated chunk into tabular (or whatever), and then expanding that out to a \halign.

Similarly, by the time that you've navigated with your mouse through the various menus in the spreadsheet program to express that you want a particular cell to span, say, three columns (this would almost always mean that you are working on a “header” cell), you would have already written \multispan3.

I can already see that I'm writing myself into a corner here, what with the various arguments for cell background colors, cells spanning multiple rows, cells containing vertical mode material, and what have you. So I'm just going to say a sweeping statement about all those things being “bad typography”. ;-).

Hold on, there's a lynch mob knocking on my door…

What I mean is that if you find yourself doing any of the above, more often than not, chances are that you are complicating the information you want to communicate with your table. And that's basically what the word “bad typography” means.

So one strong argument still remains: to visually see the structure of the table, be it in raw text (like in the orgmode answer, vims equivalent, or in the various Markdown extensions), or in graphical programs (like in spreadsheet programs).

This could again be just a s/<colsepchar>/\&/g and s/<rowsepchar>/\\cr/, in whatever chunk you get out from the program of your choice. Like, not a big deal at all. Or alternatively on the TeX side of things, some \catcode madness could take place. Given that the table is simple enough, i.e., not complicating the information you want to communicate with it.

So, given this context and background, I hope my initial joke's not lost on anyone and this answer could happily live in this question! ;-)

share|improve this answer
    
This does not quite answer the question. Perhaps it would better suit here: tex.stackexchange.com/questions/12672/… –  krlmlr Mar 26 '12 at 18:58
    
All fair. The sed script and the vim mode you mentioned each deserve an own answer. -- You forget that usually you not only want to see the structure of the table, but also to edit it so that it best communicates the information you want to present. Hacking a table is fast, even in LaTeX. Modifying it later is a PITA, and this is the very reason for the question. –  krlmlr Mar 27 '12 at 11:48

I was reluctant to publish this humble tool, but here it goes.

excel2datatool

excel2datatool is a Java application I wrote to help me with a personal project. Since it was useful for me and I do believe it's generic enough for other purposes, I decided to make it publicly available. The repository is hosted on GitHub.

The whole idea is to read Microsoft Excel formats and generate .csv + .tex + datatool. Some might argue that this app is basically a CSV converter. Well, it is, but since I had to write a complementary .tex file with \DTLloaddb, I decided to automate steps.

Main screen

The app does not rely on Microsoft Excel. It supports both xls and xlsx out of the box. The usage is quite easy, double-click excel2datatool.jar in Windows and Mac, or run java -jar excel2datatool in Linux. The code is Java 5, 6, 7 and OpenJDK 6 compliant.

Pros

  • There's no need for Microsoft Excel or other office tool.
  • It supports both xls and xlsx formats out of the box.
  • Runs on every major operating system.
  • The LaTeX file generation is optional, so you can use it as a normal CSV converter.

Cons

  • I wrote the app.
  • Since it doesn't rely on external applications, the payload is quite big (9.5Mb).
  • The LaTeX file will contain the most basic datatool usage, with \DTLloaddb. There are no advanced commands.
  • No command line interface.
  • Some people might not like the drag-and-drop style.
  • The application tries its best to parse the Excel file, but there are probably some more complex files which won't be correctly converted.
share|improve this answer
7  
Thumbs up for going open source! –  krlmlr Mar 26 '12 at 14:42

Orgmode

Orgmode is a notes/planning mode for Emacs that has a nice table feature.

http://orgmode.org/

Pros

  • Column widths auto-adjust based on contents
  • Behaves as a spreadsheet, including calculations, row/column insert and delete, row/column moves, rectangular selection
  • Import and export of TAB or whitespace separated data
  • Lots of export options (LaTeX, HTML, PDF)

Cons

  • Requires Emacs which has a significant learning curve if you are not already using it
  • Some advanced LaTeX table formatting is still done manually after export
share|improve this answer

Numbers2LaTeX

A quick hack from long time ago that converts a table in numbers (for Mac OS X) to a LaTeX table: https://gist.github.com/386384

share|improve this answer

Often, I have the use-case that I want to convert a given data table into a "suitable" LaTeX table.

Typically, my data is of numeric type and requires number formatting, perhaps alignment at a decimal point, and in most cases, it requires elementary post-processing (like quotients, differences, gradients).

Since I needed such stuff very often, I wrote some C++ scripts which generated .tex files. It was useful - but I realized very early that it is insufficient; it is just not flexible enough and -as any external tool- produces unwanted complications due to the many tools involved.

My solution is the LaTeX package pgfplotstable. It is a LaTeX table generator, i.e. it converts input data explicitly by a set of configurable rules into something like \begin{tabular}....\end{tabular}.

DISCLAIMER NOTE: I wrote the package.

Among its features are

  • separation of data + format
  • data in form of external data files (CSV with customizable separators) or inline tables (inside of the .tex file)
  • central format definition (for example in the preamble or in form of styles)
  • format numbers with the full power of LaTeX
  • supports simple text columns as well
  • simple support for alternating row colors (colortbl)
  • simple support for standart LaTeX table packages (booktabs, longtable, colortbl, multirow, \multicolumn,...)
  • can produce completely new columns containing postprocessed data, with the powerful pgf math engine
  • can convert single-column output to two-column output
  • is written completely in TeX (no external tools required)
  • highly customizable
  • has a manual with lots of examples.

You may want to inspect the link mentioned above and its examples to see if it fits your needs.

share|improve this answer
    
Quite some time has passed, and the list grows and grows... Could you please add a CW answer that will contain a list of all tools mentioned plus a direct link to the answer? I will accept this answer so it stays on top. A stub will do, I'll add some more content. Danke schön :-) –  krlmlr May 23 '12 at 7:49
    
Well, someone might change it to a community wikki (I do not know how). But why, precisely do you want to? I mean, there are lots of useful answers and readers of the page get some "community priorization" using the votes. Do you just want to have a "table-of-contents"-answer? IMHO, this is already given by the tex.se answer system here. –  Christian Feuersänger May 23 '12 at 17:40
    
Yes, I would like to have a TOC answer, and I was suggesting that you add a new answer in addition to yours. -- What exactly do you mean by "this is already given by the tex.se answer system here"? Is there a way to display a brief overview of all answers? –  krlmlr May 23 '12 at 19:34
    
Hm, you are right - there is no TOC as you requested. But whenever I try to find something, I am typically happy if I can browse through the answers of users - to see votes of others, comments, potential problems, examples,... a TOC seems somewhat out-of-place on this site (which is a Q&A site, after all). Perhaps you should take the information and write some short article - a survey about available table packages, including a comparison. On tex.se, I would not want to read a TOC answer unless it is automatically generated of the type <pos> <number votes> <title>. –  Christian Feuersänger May 25 '12 at 20:21

Your Answer

 
discard

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.