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,

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,

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