The goal of my program is to read two Excel files and compare them for differences. The whole program is run multiple times as it runs through a for loop (using fullList). I have achieved this and it works but I want to now be able to output the information in one Excel with each element of the list being on a new sheet. This is relevant code I have, when I open the Excel file after running there is no output. (workbook is included as well because in another part of the program I write strings to the same file, that part works)
fullList = ['a','b','c',...]
labels = ['a','b','c',...]
dfA = pd.read_csv('01.csv')
dfB = pd.read_csv('02.csv')
workbook = xlsxwriter.Workbook('NewExcelFile.xlsx')
worksheet = workbook.add_worksheet()
writer = pd.ExcelWriter('NewExcelFile.xlsx', engine='xlsxwriter')
marker = 0
for element in fullList:
dfA_prod = dfA[dfA["Column in A"] == "%s" %(element)]
dfB_prod = dfB[dfB["Column in B"] == "%s" %(element)]
...
dfA_prod.to_excel(writer, sheet_name='%s' %(labels[marker+1]))
dfB_prod.to_excel(writer, sheet_name='%s' %(labels[marker+1]))