[Python] Write variable sheets from Python to Excel

Discussão em 'Python' iniciado por Stack, Julho 12, 2025.

  1. Stack

    Stack Membro Participativo

    I want to write 250 sheets in Excel with the sheet number as variable. Since then I can be specific which output I want on which sheet. I tried

    from xlwt import Workbook
    wb = Workbook()
    for i in range(250):
    sheeti = wb.add_sheet('Sheet i')


    Which gives me logically the error that the worksheet name is duplicated. This is of course because every sheet is now called 'Sheet i'.

    Moreover, if I want to write the sheet with the following code

    sheeti.write


    It gives me that sheeti is not defined.

    I can not figure out the solution to this problem. Any help is appreciated.

    Continue reading...

Compartilhe esta Página