Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xls2csv: wrong date cells parsing

Tags:

parsing

xls

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

like image 897
jonny Avatar asked Jun 20 '12 06:06

jonny


1 Answers

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.

like image 163
Ωmega Avatar answered Sep 29 '22 09:09

Ωmega