I am using Perl module Spreadsheet::DataFromExcel to read Excel files. It sounds to be a very simple interface to handle Excel file. The big problem I have is the date field like '02/09/2010' is transfered into a number '40218'. I am not sure how this number is calculated? Is there any work around for this issue? or any formula from '02/09/2010' to '40218'?

Another issue is: the contents in the parsed array of array have '\0' inserted between every two characters. so I have to remove them before using these data

Many thanks

lihao

Update:First, Many thanks to both who suggested, I've tested ww's suggestion with MySQL:

to_days('2010-02-09') - to_days('1900-01-01')

which returns 40216 (very close to the value 40218 I got)? Does anyone know of where the small difference comes from?? Many thanks again.

BTW. I am using the RHEL5 as the OS to run my Perl script.

Update: After google with Excel 1899-12-30 issue, I guess, ww's comment is right, this is a known issue with Excel. So my problem is basically solved. :-)


In reply to Question with Spreadsheet::DataFromExcel by lihao

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.