Skip to content

Commit 61a4222

Browse files
authored
Python Write Excel File using xlwt
Python Write Excel File using xlwt
1 parent 0e54556 commit 61a4222

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

write_excel.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import xlwt
2+
3+
workbook = xlwt.Workbook()
4+
sheet = workbook.add_sheet("contacts")
5+
6+
header_font = xlwt.Font()
7+
header_font.name = 'Arial'
8+
header_font.bold = True
9+
10+
header_style = xlwt.XFStyle()
11+
header_style.font = header_font
12+
13+
sheet.write(0, 0, 'Name', header_style)
14+
sheet.write(0, 1, 'Email', header_style)
15+
16+
sheet.write(1, 0, 'Julie Scott')
17+
sheet.write(1, 1, '[email protected]')
18+
19+
sheet.write(2, 0, 'Harry Hernandez')
20+
sheet.write(2, 1, '[email protected]')
21+
22+
workbook.save('contacts.xls')

0 commit comments

Comments
 (0)