Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in Python by (16.4k points)

In Excel, with the help of python, How can I format the cells?

I also want to change the font of many rows to be normal instead of bold.

1 Answer

0 votes
by (26.4k points)

Try executing the below code:

from xlwt import *

font0 = Font()

font0.bold = False

style0 = XFStyle()

style0.font = font0

wb = Workbook()

ws0 = wb.add_sheet('0')

ws0.write(0, 0, 'myNormalText', style0)

font1 = Font()

font1.bold = True

style1 = XFStyle()

style1.font = font1

ws0.write(0, 1, 'myBoldText', style1)

wb.save('format.xls')

Interested to learn python in detail? Come and join the python online course to gain more knowledge!!

Related questions

0 votes
1 answer
+11 votes
2 answers
0 votes
1 answer
asked Dec 10, 2020 in Python by laddulakshana (16.4k points)
0 votes
1 answer
asked Mar 23, 2021 in Python by laddulakshana (16.4k points)
0 votes
1 answer

Browse Categories

...