Sometimes we want to remove a sheet that is no longer useful. We can do so in two ways. The first way is to use the
The other way is to use the
del keyword, accessing the appropriate worksheet with square brackets:
Either way, this action results in deleting a given worksheet and all of its contents, so proceed with caution. Otherwise, you may lose some precious data.
However, remember that you have to save changes to a file. If you delete a worksheet from your workbook in Python, it doesn't mean it will be deleted from the
xlsx file. You must save the workbook to a file if you want to preserve your changes.