Menu

Option_d_Example

Larry Jordan

Option -d

-d <format string>

Date format within csv data is specified by fmt string format string.

The csv data will be converted to the native format used in a spreadsheet cell. The cell's date format can then be set to any desired format.

See codes for the format string in the Online Manual.

Input data.csv

 2011-07-10, "Pickup chips", 45
 2011-07-22, "Shred Papers", 90
 2011-08-01, "Meeting", 240

Template template.odt

Date Task Minutes
January 1, 2000 Dummy 0

Output output.odt

Date Task Minutes
July 7, 2011 Sweep floor 30
July 22, 2011 Count beans 60
August 01, 2011 Pickup chips 45

The date was converted to a format specified by the spreadsheet.

Command

 csv2odf -d "%Y-%m-%d" data.csv template.ods output.ods

xlsx Dates

xlsx files present a problem because their cell formatting is not so easy to identify. As a workaround, you will be required to use the tag [csv2odf-date] in the template date cell as identification.

xlsx Template template.xlsx

Date Task Minutes
[csv2odf-date] Dummy 0

Related

Wiki: Manual
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.