How to set background color for row using set_bg_color -> https://xlsxwriter.readthedocs.io/format.html#set_bg_color but for specific column range? I mean not for entire row but from A2 to G2.
This is what I've done:
header_format = workbook.add_format({
'bold': True,
'text_wrap': False,
'valign': 'top',
'fg_color': '#D7E4BC',
'border': 1})
text_format = workbook.add_format({'text_wrap': True})
for col_num, value in enumerate(columns_list):
worksheet.write(0, col_num, value, header_format)
# set column length
length_list = [len(x) + 15 for x in columns_list]
for i, width in enumerate(length_list):
worksheet.set_column(i, i, width, text_format)
# format column description
if i == 1:
description_format = workbook.add_format({
'italic': True,
'bg_color': '#ebe7ae',
'border': 1,
'text_wrap': True})
worksheet.set_row(i, 50, description_format)