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.
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 is available in this archive directory of csv2latex and compiles on Unix and probably any POSIX systems. If you don't have the make utility to get the binary, just use your C compiler:
~$ cc -o csv2latex csv2latex.c
and move csv2latex to your binaries directory (usually ~/bin/ or /usr/local/bin/).
The manpage source is written in SGML docbook. To get the manpage, use the docbook-to-man script provided by your distro as is:
$ docbook-to-man csv2latex.sgml > csv2latex.1 && gzip csv2latex.1
then install the man page into your man1 directory (usually /usr/local/share/man/man1) and update the man database cache (using updatedb as root).
The latest source is in a SVN repository, freely accessible
at: http://herewe.servebeer.com/svn/csv2latex
Here is a csv2latex ebuild for gentoo linux, thanks to Daniel Pähler. You will need the "docbook-to-man" utility in order to install the manpage.
The official Debian package of csv2latex is coming into debian sid, thanks to Rafael Laboissiere.
RPM packages of csv2latex are available at Dries Verachtert's RPM Repository.
MacOS X binaries can be found at Softpedia's csv2latex page for Mac Thanks to the Softpedia crew.
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.