I'm iterating over a pandas dataframe during and carry out and operation to obtain the information (excel sheet number) for saving the appropriate excel sheet like this:
from opnepyxl.utils.dataframe import dataframe_to_rows
for i,data in df.iterows:
sheet=data['SheetNo']
#Create excel writer
writer=pd.Excelwriter('output.xlxs')
# write dataframe to excelsheet
data.to_excel(writer, sheet)
#save the excel file
writer.save()
Dataframe:
ID SheetNo setting
2304 2 IGV5
2305 3 IGV2
2306 1 IGV6
2307 2 IGV2
2308 1 IGV1
What I wanted was for data to go into each of the created 'SheetNo' of the excel file, instead the the previous sheet is being overwritten by the following one, and you can only see the last sheet number.
What can I do to make this code work? Any other approach apart from mine above will be welcome.

output.xlsx? If yes, you have repeatedSheetNofor 1 and 2. Should that not be unique?