df = pd.read_excel('data.xlsx')
xls = pd.ExcelFile('data_nb0.xlsx') df = xls.parse('sheet1')
writer = pd.ExcelWriter('data.xlsx') new_df.to_excel(writer, sheet_name='sheet1', index=True) writer.save()
注意:寫入完畢後要加上writer.save(),不然會報錯:ui