The list of dataframes
df_list = [summary, df3, df4, df5, df6]
Names of excel sheets where the output has to be written
Names = ['Liability','Expenses','Income','Asset']
writer = pd.ExcelWriter(r"E:\GL\2040001.xlsx", engine='xlsxwriter')
If a dataframe has output then the file has to be written to excel
for i in df_list: if i.empty is False: for j in Names: i.to_excel(writer, sheet_name = j)
I want the files which are not empty to be written with its corresponding dataframe