summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2013-06-05 12:55:18 -0500
committerJesse Luehrs <doy@tozt.net>2013-06-05 12:55:18 -0500
commit940ac69408ea7a98795652b8fcb5c6045528ac2e (patch)
treefd7d18bc52673f1f6808f30de44e7c274dc40a2e
parentd91245496d5828392dc54911ca7688c57efae4c0 (diff)
downloadspreadsheet-parsexlsx-940ac69408ea7a98795652b8fcb5c6045528ac2e.tar.gz
spreadsheet-parsexlsx-940ac69408ea7a98795652b8fcb5c6045528ac2e.zip
introspect datetime cells from the num format too
-rw-r--r--lib/Spreadsheet/ParseXLSX.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Spreadsheet/ParseXLSX.pm b/lib/Spreadsheet/ParseXLSX.pm
index 880d2e0..71af8fe 100644
--- a/lib/Spreadsheet/ParseXLSX.pm
+++ b/lib/Spreadsheet/ParseXLSX.pm
@@ -132,10 +132,19 @@ sub _parse_sheet {
die "unimplemented type $type"; # XXX
}
+ my $format = $sheet->{_Book}{Format}[$cell->att('s') || 0];
+
+ # see the list of built-in formats below in _parse_styles
+ # XXX probably should figure this out from the actual format string,
+ # but that's not entirely trivial
+ if (grep { $format->{FmtIdx} == $_ } 14..22, 45..47) {
+ $long_type = 'Date';
+ }
+
$sheet->{Cells}[$row][$col] = Spreadsheet::ParseExcel::Cell->new(
Val => $val,
Type => $long_type,
- Format => $sheet->{_Book}{Format}[$cell->att('s') || 0],
+ Format => $format,
($cell->first_child('f')
? (Formula => $cell->first_child('f')->text)
: ()),