0

Just want to know how to create a variable for underlining text in the package xlsxwriter. For example, this is the one I created for making it bold:

bold_format = workbook.add_format({'bold': True})

Sorry if the answer is blatantly obvious, I tried looking it up to no avail.

BenDeagle
  • 1
  • 1

1 Answers1

0

You can specify several different cell formats in the dictionary:

cell_format = workbook.add_format({'bold': True, 'font_color': 'red', 'num_format': '$#,##0.00',})
worksheet.write('A1', 'Cell A1', cell_format)

# Later...
cell_format.set_font_color('green')
worksheet.write('B1', 'Cell B1', cell_format)