File encryption or password protection

Hi again to all,

I would like to be able to encrypt or protect an Excel file.
The program takes input from users and puts it in an Excel file.
When the program will run for the first time, the user will be asked to set a password.
From here, any time the program starts, the user will be asked to type the password in order to work with the Excel file.

Any help will be appreciated :slight_smile:

Hi, check out these links, lots of info:

https://blog.aspose.com/cells/encrypt-and-decrypt-excel-files-in-python/

https://duckduckgo.com/?q=python+encrypt+and+decrypt+excel+file+using+password

A lot of coding is searching for what you need to know, everyday.

Just to give you some guidance, you can accomplish this using just the following libraries: ‘os’, ‘bcrypt’, and ‘openpyxl’. Additionally, I’ll say that you’re just using ‘bcrypt’ to securely hash and verify passwords, which is done with ‘bcrypt.hashpw()’, ‘bcrypt.gensalt()’, and ‘bcrypt.checkpw()’ for verification. There are probably other ways of accomplishing the task but using these packages you can do it in less than 30 lines of code.

1 Like