mirror of
https://github.com/kennethreitz/tablib.git
synced 2026-06-05 23:10:17 +00:00
25 lines
489 B
Python
25 lines
489 B
Python
import xlwt
|
|
from datetime import datetime
|
|
|
|
font0 = xlwt.Font()
|
|
font0.name = 'Times New Roman'
|
|
font0.colour_index = 2
|
|
font0.bold = True
|
|
|
|
style0 = xlwt.XFStyle()
|
|
style0.font = font0
|
|
|
|
style1 = xlwt.XFStyle()
|
|
style1.num_format_str = 'D-MMM-YY'
|
|
|
|
wb = xlwt.Workbook()
|
|
ws = wb.add_sheet('A Test Sheet')
|
|
|
|
ws.write(0, 0, 'Test', style0)
|
|
ws.write(1, 0, datetime.now(), style1)
|
|
ws.write(2, 0, 1)
|
|
ws.write(2, 1, 1)
|
|
ws.write(2, 2, xlwt.Formula("A3+B3"))
|
|
|
|
wb.save('example.xls')
|