I have a script which creates an excel workbook with two worksheets, the script formats cells, etc. in sheet1 however I also want to do the same formatting in sheet2. Is there an easy way to do the formatting to both sheets at the same time instead of making a full copy of what is done for sheet1 and doing for sheet2 also.
Below is some of the code i have and want to do for both sheets
workbook = xlsxwriter.Workbook(outFileXLSX)
worksheet1 = workbook.add_worksheet('Results 1')
worksheet2 = workbook.add_worksheet('Results 2')
sheet1 = worksheet1
sheet2 = worksheet2
sheet1.merge_range('A1:A4', '', format_header)
sheet1.merge_range('B1:B4', 'Merged Range', format_header)
The two lines above i need to do also in sheet2
Any help or advise would be great