CSV2LaTeX, a csv to LaTeX file converter

csv2latex converts a well formed csv file (as done by OOo Calc, gnumeric or Excel) to a LaTeX document. it is written in C and flush the document to the standard output. The number of columns is automatically detected.

Examples

let's say we have to convert a table.csv to a document.tex file. This generally do the trick:

~$ csv2latex table.csv > document.tex

However... we can specify the format of the csv file, and some output disposition:

~$ csv2latex --separator c --block d --lines 40 --position l table.csv > document.tex

this previous command takes a csv file which separator is a comma, block delimiter is a double-quote, and produces a LaTeX document with 40 lines per table and where the text is flushed left in each cell. 40 lines is a good average for A4 paper.

another example:

~$ csv2latex --separator s --block q --lines 20 --position c table.csv > document.tex

this one takes a csv file which separator is a semi-colon, block delimiter is a simple quote and produces a LaTeX document with 20 lines per table and where the text is centered in each cell.

If you have tricky block delimiter such as $ and separators like tabs, let the program guess:

~$ csv2latex --guess table.csv > document.tex

Source code

The latest source is in a SVN repository, freely accessible at: csv2latex svn repository

Binary package

Debian package (source + binary)

The official Debian package of csv2latex is coming into debian sid, thanks to Rafael Laboissiere.

if you like this software...

Feel free to report any successful or painful stories using csv2latex. To help the maintenance of csv2latex, you can send patches or feature requests to me. Packaging for your favourite distro would also be very nice. This software is licenced under the GNU General Public Licence version 2.


Any question on csv2latex? contact me by email.