This is a tutorial on a quick way to create a template for csv2odf.
For this tutorial we will use a short csv file with some stock market information downloaded from Yahoo.
The csv file looks like this:
"CAT","Caterpillar, Inc.",103.54,1.74,"Jan 18" "JNJ","Johnson & Johnson",60.70,2.11,"Nov 26" "T","AT&T Inc.",28.47,1.69,"Jan 6" "IBM","International Bus",163.85,2.60,"Feb 8" "DIS","Walt Disney Compa",43.41,0.40,"Dec 9" "GE","General Electric ",21.33,0.46,"Dec 22" "UTX","United Technologi",85.20,1.70,"Nov 17"
For our example we save the file as quotes.csv
Import this csv file into a spreadsheet. We will turn this spreadsheet into a template for csv2odf.
After importing it looks like this:
Now delete all the spreadsheet rows except the first two. The first row will contain the header rows for the report. The second row will be sample data that we can format any way we want. Be sure each sample item in the second row in unique, otherwise the word processor may combine them to save space and causing problems for csv2odf.
Label the first row of the spreadsheet with these names:
Symbol, Name, Price, Div, Div Date
You can format the cell just about any way you like. It's usually nice to make the heading bold, and sometimes a different background color.
You can also format the data row. However you format it, every row in the final report will get the same format.
For our example, we made the title row bold with background color turquoise; in the data row the symbol and price are bold and the price and div have two decimal places.
For this example we save the template as template.ods.
This command will create output.ods:
csv2odf quotes.csv template.ods output.ods
The output looks like this:
The template is now ready to use. Whenever new data is available, you can run csv2odf again and get a nice looking output with up-to-date information.