Hi
just finished writing some code to generate reports by writing data
into an Excel spreadsheet using COM. (Unfortunately XLWT/XLRD etc
wasn't an option because the Excel spreadsheet included charts).
Since there are numerous examples for open, writing to, and saving
Excel files I won't go into that here :-)
One tidbit I found was that Excel time formatted data is stored as a
decimal value between 0.0 and 1.0 depending on how far through the day
it is.
Here is some example code for converting a time to Excel format,
suitable for writing into an Excel time formatted field.
def cnvrt_time(csv_time):
# csv_time is time in format '00:10:22.634' = 'hh:mm:ss.xxx'
# excel time format stores time as decimal
secs_in_day = 24*60*60
csv_time = csv_time.split('.')[0] # drop milliseconds
[hrs,mins,secs] = csv_time.split(':')
total_secs = float(secs)+60*float(mins)+3600*float(hrs)
time_in_xcl_fmt = total_secs / secs_in_day
return(time_in_xcl_fmt)
Hope it's useful to somebody else.
Mike