Phillip M. Feldman
import openpyxl
wb = openpyxl.workbook.Workbook()
ws = wb.create_sheet()
wb.remove_sheet(ws)
I'm doing something similar:
(code that creates the workbook and generates several sheets)
try:
sh= get_sheet_by_name('Sheet')
self.book.remove_sheet(sh)
except:
print("Warning: write_xls is unable to remove the sheet called
'Sheet'.")
pass
self.book.save(self.fname)
Invariably, I get the warning and the sheet called "Sheet" is
present. Any idea why this is happening? Thanks!
Phillip
On Dec 3, 1:50 am, Eric Gazoni <eric.gaz...@gmail.com> wrote:
> Hi Philip,
> the function remove_sheet() takes a worksheet object as argument.
>
> You can use it this way:
>
> import openpyxl
> wb = openpyxl.workbook.Workbook()
> ws = wb.create_sheet()
> wb.remove_sheet(ws)
>
> Cheers,
> Eric
>
> Le 3/12/11 03:26, Phillip M. Feldman a �crit :