jonny
jonny

Reputation: 736

xls2csv: wrong date cells parsing

I format dates with the command line option -f %Y-%m-%d or even %d-%b-%y

but each date comes out four years and one day ahead of the date I input

for example, date 01.06.2012 after parsing without -f option comes as 2016-06-02 toying with -f gives same result

What is the reason? Are there any workarounds, except hardcode and substract back these 4 years and 1 day?

I am using xls2csv (by V.B.Wagner, comes with catdoc package in debian) and switching to another parser can be very expensive option

Upvotes: 7

Views: 1902

Answers (2)

Christophe Deleuze
Christophe Deleuze

Reputation: 39

That's a known bug. A patch is available at https://www.wagner.pp.ru/cgi-bin/cvstrac/catdoc/tktview?tn=14,4

It works. By the way, there are two programs called xls2csv, we're talking about the one from the catdoc package, not the Perl program.

Upvotes: 3

Ωmega
Ωmega

Reputation: 43703

Tools xls2csv is a Perl application that uses Spreadsheet::ParseExcel library.

Based on such library documentation, one of known problems is:

  • If Excel has date fields where the specified format is equal to the system-default for the short-date locale, Excel does not store the format, but defaults to an internal format which is system dependent. In these cases ParseExcel uses the date format 'yyyy-mm-dd'.

So you probably manipulate with Excel file that does not contain date formating due to above listed issue.

Upvotes: 3

Related Questions