I want to produce a multisheet CSV file from a multisheet xlsx file. For that I wrote this code:
xls = xlrd.open_workbook(r'Smallys ORDER.xlsx', on_demand=True)
df_list = []
names = xls.sheet_names()
names.remove('EVENT')
for name in names:
prod = pd.read_excel('Smallys ORDER.xlsx', name, index_col=None)
prod.to_csv(name + '.csv', encoding='utf-8', index=False)
df_list.append(prod)
df_final = pd.DataFrame()
for df in df_list:
df_final.append(df)
df_final.to_csv('smallys.csv', encoding='utf-8', index=False)
It successfully converts the individual xlsx sheets to csv files. But cannot produce the multisheet csv.
this print(df_final) outputs this :
Empty DataFrame
Columns: []
Index: []