[Python] IndexError: At least one sheet must be visible + Excel file broken

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

  1. Stack

    Stack Membro Participativo

    I am new in Python and do not find the solution to solve this issue. When I launch this script I have this error message : IndexError: At least one sheet must be visible.

    Moreover, this script corrupt the excel file. The file is broken after this.

    import pandas as pd
    import numpy

    # opening the source excel file
    filename = r"C:\Users\Desktop\Docs\Excel To Automatize\file.xlsx"
    wb1 = pd.read_excel(filename)

    sheets = ["Efdfg", "khefjkh", "jdshfjhd"]

    df = pd.concat(pd.read_excel(filename, sheet_name = sheets))

    with pd.ExcelWriter(filename, engine = 'openpyxl', mode = "a" ) as writer:

    df.to_excel(writer, sheet_name = "Aggregate Table", Index = False)

    Continue reading...

Compartilhe esta Página