workbook = xlsxwriter.Workbook('demo1.xlsx')
worksheet = workbook.add_worksheet()
format = workbook.add_format({ 'bg_color': '#5081BB','font_color': '#FFFFFF','font_size': 12,'text_wrap':'true'})
textWrap = workbook.add_format({'text_wrap':'true'})
col = 0
row = 0
for i in data["tabledata"]:
for j in i:
worksheet.write(row, col, j,textWrap)
col = col+1
row = row+1
col = 0
worksheet.set_row(0, 20, format)
worksheet.set_row(1, 20, format)
workbook.close()
this is not properly works, then what is the use of set_row and set_column? how to apply the format for specific row/column? and also i need to apply date format for date columns.
worksheet.set_column(7, none, Dateformat) ?
Formatting works in XlsxWriter like in Excel: a cell format overrides a row format which in turn overrides a column format.
So if you want a cell to have a format plus the same formatting as the row or column you will have to define a format object that contains all the formats that you want.