Please see the following code. It iterates all the password list and tries to open the workbook one by one with each password. If the workbook is loaded successfully, it prints a message “Workbook loaded successfully” and if none of the password worked, then it prints a message "All passwords are wrong."
I have written another sample code for your reference for your needs. I have stored some passwords in an array list. The code will first check if the underlying file is encrypted and then trying loop through each password in the list to try to open the file by Aspose.Cells APIs. Once the password is matched and found, it opens the file successfully and exit the loop etc.
You are welcome, hopefully the code segments would help you to accomplish your tasks. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.