Menu

Option_o_Example

Larry Jordan

Option -o <spec>

Specify column order: 2,1,3 = second csv column is first. Also use to leave the contents of a template column: 1,2,,3,4 = the 3rd template column is not overwritten. Useful if a column contains a formula. The formula cell references will be offset to the correct row.

Input data.csv

 2011-06-14, "Sweep floor", 30, 22
 2011-06-15, "Count beans", 60, 12
 2011-07-10, "Pickup chips", 45, 10

Template template.odt

Date Minutes 1 Minutes 2 Total Tasks
2000-01-01 0 1 =B2+C2 Dummy

Output output.odt

Date Minutes 1 Minutes 2 Total Tasks
2011-06-14 30 22 =B2+C2 Sweep floor
2011-06-15 60 12 =B3+C3 Count beans
2011-07-10 45 10 =B4+C4 Pickup chips

The order of the data columns was changed. If this was a spreadsheet, the formula would be adjusted as the rows change and the correct result would be displayed.

Command

csv2odf -o "1,3,4,,2" data.csv template.ods output.ods

Related

Wiki: Program_Options_by_Example

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.