csv2odf Wiki
csv2odf can convert csv data to formatted spreadsheets and documents.
Brought to you by:
w322
If you have a database that receives periodic updates and you need to generate a report at scheduled intervals from the database. Here are the steps required to do this:
This can be accomplished with a command like this in Linux:
cat query.sql | mysql -u Username -p | csv2odf template.ods > output.ods
The cat command pipes an SQL query to mysql. Mysql outputs csv data to csv2odf. Csv2odf outputs a nicely formatted ods spreadsheet.
A few options need to be added to the SQL query so that it will produce csv data:
SELECT field1, field2, field3 FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM table;