Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

parse Excel number which represents a date

by fionbarr (Friar)
on Aug 28, 2015 at 13:48 UTC ( [id://1140328]=perlquestion: print w/replies, xml ) Need Help??

fionbarr has asked for the wisdom of the Perl Monks concerning the following question:

good morning I am trying to parse an xlsx file with Spreadsheet::XLSX There are text data that appears on the Excel sheet as 'Thu, Jan 14' where the extracted data has the value '42387'. Any clue how I can parse this value to derive the text date?
  • Comment on parse Excel number which represents a date

Replies are listed 'Best First'.
Re: parse Excel number which represents a date
by Corion (Patriarch) on Aug 28, 2015 at 13:59 UTC

    That is how Excel represents dates. See Spreadsheet::ParseExcel for the routines that convert from numbers to formatted strings or just use the formatted value instead of the raw value. Maybe also consider Spreadsheet::ParseXLSX, which is more recent.

      Success with 'Spreadsheet::ParseXLSX'. Thanks to Corion and others who suggested possibilities.
Re: parse Excel number which represents a date
by tangent (Parson) on Aug 28, 2015 at 15:13 UTC
    How are you getting the value of the cell? If you use:
    $cell->{Val}
    then you will get the unformatted value, but if you use:
    $cell->value()
    you should get the formatted value
Re: parse Excel number which represents a date
by MidLifeXis (Monsignor) on Aug 28, 2015 at 14:37 UTC

    See also CPAN.

    --MidLifeXis

Re: parse Excel number which represents a date
by fionbarr (Friar) on Aug 28, 2015 at 14:01 UTC
    more info:

    the date is '1/14/2016' which is represented by the number '42387'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1140328]
Approved by Athanasius
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-19 13:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found