Converting to csv using libreoffice


I’m using the following command for converting xls or xslx to csv :
libreoffice --headless --convert-to csv [filename] --outdir [path]

Assume that I am xls/xslx created by user in Windows environment and sometime has the has date-time written by user like this : dd/mm/yyyy.

When I convert to csv I get the date format change to mm/dd/yyyy.
How can avoid it, isn’t it possible just to spit out the xls/xslx data as the same string to the csv with interpreting date-times?

How do you know how a user had written a date? I would expect Excel style files to contain dates as numeric data as Calc does.
If the “dates” actually are text you may need to disable the “recognition” which may be a misinterpretation under a different locale before they are finally written to csv.
Regarding the filter options @librebel already pointed to this can be achieved for the first column (e.g.) by the column formatitng 1/2 in the sixth position of the options string.

See Convert-to from csv to ods and viceversa fore more details

Hello @mulder,

you could try to run the command as:

libreoffice --headless --convert-to csv:"Text - txt - csv (StarCalc)":",,,,1/3" [filename] --outdir [path]

( This assumes that the date field is the first field).

please see Filter Options for the CSV Filter