I am using checkbox ( that are excel sheet names) based on number of checkboxes selected, I want to save on those sheets on excel file . When I select a check box, the page refreshes
out_path = r"D:\\\file.xlsx"
writer = pd.ExcelWriter(out_path, engine='xlsxwriter')
st.sidebar.write('Select your required sheets')
aa=st.sidebar.checkbox("sheet1")
bb=st.sidebar.checkbox("sheet2")
cc=st.sidebar.checkbox("sheet3")
dd=st.sidebar.checkbox("sheet4")
ee=st.sidebar.checkbox("sheet5")
if aa==1:
dr.to_excel(writer, sheet_name='sheet1',index= False )
elif bb==1:
dt.to_excel(writer, sheet_name='sheet2',index= False)
elif cc==1:
ds.to_excel(writer, sheet_name='sheet3',index= False)
elif dd==1:
du.to_excel(writer, sheet_name='sheet4',index= False)
elif ee==1:
de.to_excel(writer, sheet_name='sheet5',index= False)
else:
st.write("You didn't select anything")
if st.sidebar.button('OK'):
writer.save()