Ask Your Question
1

Converting to csv using libreoffice [closed]

asked 2017-07-26 17:40:06 +0100

mulder gravatar image

Hi

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?

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by cloph
close date 2017-08-22 16:27:16.143735

Comments

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.

Lupp gravatar imageLupp ( 2017-07-27 10:59:02 +0100 )edit
cloph gravatar imagecloph ( 2017-08-22 16:28:14 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2017-07-27 08:52:33 +0100

librebel gravatar image

updated 2017-07-27 09:03:36 +0100

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

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-07-26 17:40:06 +0100

Seen: 1,480 times

Last updated: Jul 27 '17