python - Writing date format using xlwt -


i'm writing date using xlwt this:

date_format = xfstyle() date_format.num_format_str = 'dd/mm/yyyy' plan.write(1,4,'01/01/2014', date_format) 

the worksheet saving fine, no errors. cell formatted date, excel not recognized date until manually double click on excel. have more 1.000 dates , can't time. there way save real date, no need manually update cell?

thanks

excel date float number in cell formatted date.

you're trying write string cell. xlwt should convert datetime object float it's not going implicitly convert string excel date.

from datetime import datetime  date_format = xfstyle() date_format.num_format_str = 'dd/mm/yyyy' plan.write(1, 4, datetime.strptime("01/01/2014", "%d/%m/%y"), date_format) 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -