Search code examples
pythonexcelxlwtxlutilspyexcel

Python - Deleting a sheet


Is there any function that has been made to delete only a single sheet using xlwt, xlrd, xlutils, xlutils.filter, or pyexcel? Those are the only ones I have access to and I want to know how to delete a sheet.

Perhaps you could create a list with all the sheet names, remove the sheet name from that you want to delete, and then copy every sheet name from that list and then save the workbook with the original name.

Any help is useful!


Solution

  • The answer that was given on the other question was this:

    write_book._Workbook__worksheets = [write_book._Workbook__worksheets[0]]
    

    This removes everything but the first worksheet associated with a Workbook.