Menu

What_is_csv2odf

Larry Jordan

What is csv2odf?

csv2odf is a command line tool that can convert a comma seperated value (csv) file to an odf document (ods or odt). csv2odf is useful for creating reports from databases and other data sources that produce csv files. csv2odf can be combined with cron and shell scripts to automatically generate business reports.

The csv data is merged with a template file to produce the output file. The template is a standard open document file as produced by OpenOffice.org. The template can be a spreadsheet file (ods) or document file (odt).

If the template is a spreadsheet, the first row will be treated as a header row (Override with -H). The second row is repeated for every row in the csv file. The formatting in the second row cells will be applied to each data cell of the output file. In a spreadsheet template, the second row needs to contain some data: cells that may contain letters (not just numbers) should have letters; adjacent cells should not contain repeated data or else OpenOffice may merge/compress them.

If the template is a document, it must contain a table that the csv data will be inserted into. The table will be processed the same as a spreadsheet.

In the header or footer of the template, you can insert a [date] tag (the word "date" enclosed in brackets). The date tag will be replaced by the current date. The date format can be changed using format codes (see below), for example [date %Y-%m-%d] will produce a date like 2008-02-04. A date with a day offset from the current date can be created by using +n or -n, for example [date-1] would insert the date before today.

For more details see the Manual.


Related

Wiki: Manual

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.