forked from ScoDoc/ScoDoc
Merge pull request 'autorise les chaînes JJ/MM/AAAA comme date' (#148) from jmplace/ScoDoc-Lille:fix_date_import into master
Reviewed-on: https://scodoc.org/git/viennet/ScoDoc/pulls/148
This commit is contained in:
commit
ef6a6d6ec2
@ -65,10 +65,16 @@ class COLORS(Enum):
|
||||
|
||||
|
||||
def xldate_as_datetime(xldate, datemode=0):
|
||||
"""Conversion d'une date Excel en date
|
||||
"""Conversion d'une date Excel en datetime python
|
||||
Deux formats de chaîne acceptés:
|
||||
* JJ/MM/YYYY (chaîne naïve)
|
||||
* Date ISO (valeur de type date lue dans la feuille)
|
||||
Peut lever une ValueError
|
||||
"""
|
||||
return openpyxl.utils.datetime.from_ISO8601(xldate)
|
||||
try:
|
||||
return datetime.datetime.strptime(xldate, "%d/%m/%Y")
|
||||
except:
|
||||
return openpyxl.utils.datetime.from_ISO8601(xldate)
|
||||
|
||||
|
||||
def adjust_sheetname(sheet_name):
|
||||
|
Loading…
Reference in New Issue
Block a user