Search code examples
pythonexcelxlwings

Xlwings / open password protected xlsx?


is there any way to open a password protected excel-sheet with xlwings? (whole xlsx is protected - that means when the excel is opened you have to put in a password to get to the excel)

If not is there any other way to protect the excel-sheet for some users - but have access with xlwings to the worksheet?


Solution

  • xlwings.Book() has a password parameter:

    password (str) – Password to open a protected workbook

    You should just be able to

    import xlwings
    
    wb = xlwings.Book("file.xlsx", password="Passw0rd!")