xlwt

Library to create spreadsheet files compatible with MS Excel 97/2000/XP/2003 XLS files

https://pypi.org/project/xlwt/

import time
import datetime
import _lib_
import xlwt

Str = 'Test'
Time = datetime.datetime.now()
Currency = 234

#Format Text
style0 = xlwt.XFStyle()
style0.num_format_str = '@'

#Format Date
style1 = xlwt.XFStyle()
style1.num_format_str = 'DD-MM-YY'

#Format Currency
style2 = xlwt.XFStyle()
style2.num_format_str = '$#,##0.00'

workbook = xlwt.Workbook()
worksheet = workbook.add_sheet('Sheet1')

worksheet.write(0, 0, Str, style0)
worksheet.write(0, 1, Time, style1)
worksheet.write(0, 2, Currency, style2)

workbook.save('types.xls')

Last updated