Converting Excel table to Latex

Table (tabular environment) in Latex is difficult to manipulate. Excel is good at manipulating tables, but as a rendering tool for latex table, Excel lacks two functionalities,

Export table to latex tabular format;
Import plain text data: right now it requires lengthy steps (in menu data->Import External Data->...).

I wrote an Excel add-in tool that provides the above two functionalities. With this tool, you can import plain text data that are generated by scripts into Excel, add column headers etc (those metadata) in Excel, and finally render the latex tabular from the Excel table. If your data is already in Excel, you don't need the import. But for me, I usually first generate plain text data using scripts and then import them into Excel.
This tool is tested on MS office 2003.
Download
xls2latex.1.0, (21 KB), 2008-June-02.
Installation
You either install the add-in into Excel, or use it without installationl.
Install and uninstall
If you want to install it, you will have a new submenu called "latex" in Excel main menu. Here are the instructions,

Download and open the latex.xls.
Create menuitem: Press Alt+F8 to bring up the macro dialog and execute "ThisWorkbook.AddMenus". You will see a new submenu called "latex" in Excel main menu. This submenu wil show up every time you open Excel.
Register the add-in: save the Excel file as ".xla" (add-in). The save file dialog will direct you to a special system directory "AddIns". Just save it there. Then click main menu Tools -> Add-Ins, and check "latex" in the pop-up window.

To uninstall, also open the original latex.xls, Alt+F8, and execute "ThisWorkbook.DeleteMenu". The submenu "latex" will disappear.
Use without installation
You can also use the add-in without installation. In this way, it's green. Just open the latex.xls first before opening your Excel file. You don't have a new submenu "latex" as in the installation mode, though. Instead, use Alt+F8 to invoke the macros directly. There is one-to-one correspondence between the macros and the menu items in the "latex" submenu:

"Convert to Latex table" <-> ToLatexTable;
"Paste plain text (space-separated)" <-> Paste_data_space;
"Paste plain text (pipe-separated)" <-> Paste_data_pipe;
"Paste plain text ..." <-> Paste_data_custom;

Usage Example
You may have to install the add-in before using it. However, if you don't want to install, you can still try it (see above).
1. Copy the plain text data. They are separated by "|".

2. Import the clipboard content into Excel by clicking the menu latex->paste plain text (pipe-separated).

3. After step 2, we have the table in Excel.

4. Add column headers in Excel. Then select the table and click menu to render it into latex. The results are copied to clipboard.

5. Paste the results to your latex document.

6. The table looks like this in pdf.

Alternatives
Generate table data csv format to avoid importing. Use another converting tool Excel2Latex to render latex.

If you happen to have any comments, I am interested to hear.
Last updated: Tuesday September 22, 2009