python - Determining if an xlsx cell is date formatted for Excel 2007 spreadsheets -


i'm working code reads data xlsx files parsing xml. pretty straightforward, exception of date cell.

dates stored integers , have "s" attribute index stylesheet, can used date formatting string. here examples previous stackoverflow question linked below:

19 = 'h:mm:ss am/pm';

20 = 'h:mm';

21 = 'h:mm:ss';

22 = 'm/d/yy h:mm';

these built in date formatting strings ooxml standard, seems excel tends use custom formatted strings instead of builtins. here example format excel 2007 spreadsheet. numfmtid greater 164 custom format.

<numfmt formatcode="mm/dd/yy" numfmtid="165"/> 

determining if cell should formatted date difficult because indicator can find formatcode. 1 date, cells formatted number of ways. initial attempt ms, ds, , ys in formatcode, seems problematic.

has had luck problem? seems standard excel reading libraries lacking in xlsx support @ time. i've read through standards , have dug through lot of xlsx files without luck.

the best information seems come stackoverflow question:

what indicates office open xml cell contains date time value

thanks!

dates stored integers

in excel data model, there no such thing integer. float. dates , datetimes floats, representing days , fraction since variable epoch. times fractions of day.

it seems standard excel reading libraries lacking in xlsx support @ time.

google("xlsxrd"). keep date, join the python-excel group.

edit see have already asked question there. if had asked question there specific one, or responded request clarification, have info on 2 weeks ago.

have @ xlrd documentation. front there discussion on excel dates. of applies excel 2007 earlier versions. in particular: necessary parse custom formats. necessary have table of "standard" format indexes date formats. "standard" formats listed in places don't include formats used in cjk locales.

options you:

(1) borrow xlrd source code, including xldate_as_tuple function.

(2) option (1) + xlsxrd bolt-on kit , borrow source code.

(3) [recommended] xlsxrd bolt-on kit , use ... set of apis operate across excel versions 2.0 2007 , python versions 2.1 2.7.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -