Disable gridlines on for top three rows

Viewed 26

I would like to disable gridlines for top four rows of spreadsheet created using xlswriter.

I have code producing the results that I expect except the top four rows still displaying gridlines. The gridlines are disabled for the entire spreadsheet except for a table that I have custom formatting applied to. The formatting is being applied to the top four rows. Is there anyway to disable formatting for top four rows? Gridlines are disabled outside table area. See pic and code snippet below.

writer1=pd.ExcelWriter(Outfile1, engine='xlswriter')

df.to_excel(writer1, sheet_name='AI Models', startrow=5, startcol=0, header=False, 
index=False)

workbook = writer1.book
worksheet = writer1.sheets['AI Models']

cell_format1= workbook.add_format({'font_name': 'calibri', 'font_size':9, 
'text_wrap': True, 'valign':'Top', 'border':1, 'border_color': '#c1c1c1'})

worksheet.hide_gridlines(2)

worksheet.set_column(0,0,8,cell_format1)
worksheet.set_column(1,1,18,cell_format1)
worksheet.set_column(2,2,10,cell_format1)
worksheet.set_column(3,3,25,cell_format1)

# write detail statements to spreadsheet
# Write misc information in rows 1(A1)

See image of top five rows

0 Answers
Related