have optimized writer create first worksheet by default

Issue #113 resolved
slestak created an issue

The Workbook class appear to create an empty worksheet when using the normal writer. For consistency, can the optimized writer do likewise?

Comments (7)

  1. slestak reporter

    One side effect of the current state is the optimized writer cannot make an empty workbook.

  2. Eric Gazoni

    may I propose it only does so if there is no worksheet at all created ? Because I find it handy not to have to delete the first worksheet before starting to dump my data into a workbook, and just creating the sheets I need. But on the other side, as long as it's documented, I do not really mind, it's a reasonable request indeed.

  3. CharlieC

    Why would you delete an empty worksheet?

    wb = Workbook(write_only=True)
    ws = wb.active # currently wb.create_sheet()
    

    We can probably clarify whether we should change with some sample code. I suppose that if you're planning to create a lot of sheets you don't want different behaviour for the first sheet.

  4. CharlieC

    Upon reflection I agree that this shouldn't happen by default. And if a workbook is empty, what's the point of using the optimised writer? If there is a need it should happen when saving the file.

  5. Log in to comment