Python: Split Each Excel Sheet Into Separate Files (fast & easy)
Language:
This video will show you how to split each worksheet in Excel into a separate Excel file/workbook using Python instead of VBA. In particular, we will be using the xlwings library.
👩💻 Source Code:
import xlwings as xw # pip install xlwings EXCEL_FILE = 'YOUR_EXCELFILE_NAME.xlsx' try: excel_app = xw.App(visible=False) wb = excel_app.books.open(EXCEL_FILE) for sheet in wb.sheets: wb_new = xw.Book() sheet.copy(after=wb_new.sheets[0]) wb_new.sheets[0].delete() wb_new.save(f'{sheet.name}.xlsx') wb_new.close() finally: excel_app.quit()