Open a file with Aspose.Cells Fails with restrict permissions

I have a file that is protected by using the excel feature File => Info => Protect Workbook => Restrict Access.

I am able to open the file using excel because my user is in the restricted access list. However Aspose on my desktop running under my user context is not able to open the file. When I open it using Aspose it is saying: Permission is required to open this file.

I’m guessing Aspose doesn’t know my user context. Any ideas on how to fix?

@tkurian

It seems that you are encountering an issue with opening a workbook that has restricted access permissions using Aspose.Cells. Unfortunately, Aspose.Cells does not have the capability to recognize user context or permissions set within Excel, which is why you are receiving the “Permission is required to open this file” error.

To work around this limitation, you can try the following approaches:

  1. Check for Password Protection: If the workbook is password-protected, you can specify the password in the LoadOptions when opening the workbook. Here’s a sample code snippet to demonstrate how to do this:

    // Specify the password to open the workbook
    LoadOptions opts = new LoadOptions();
    opts.Password = "your_password"; // Replace with the actual password
    
    // Open the source Excel file with load options
    Workbook workbook = new Workbook("path_to_your_file.xlsx", opts);
    
  2. Review Access Permissions: Ensure that the workbook is not restricted in a way that prevents Aspose.Cells from accessing it. If possible, try to remove the restricted access settings temporarily to see if that allows you to open the file.

  3. Contact Support: If the above solutions do not resolve your issue, consider reaching out to Aspose support for further assistance. They may have additional insights or updates regarding handling restricted access workbooks.

For more detailed information on handling protected workbooks, you can refer to the following resources:

If you have any further questions or need additional help, feel free to ask!

Is there a way to remove the protection access.

@tkurian,

I think when I will try to open your file manually in MS Excel, it will require account credentials and permissions set. We are sorry but we cannot support loading/reading such restricted and encrypted files. Please not, Aspose.Cells works on file formats and underlying XML data of the source file, so the exception is inevitable. There is no encryption info documented in the source file, so we cannot support loading/reading such restricted and encrypted files. The file does not contain encryption info, and MS saves encryption info on their servers. MS Excel will fetch them with your certificate (using credentials) when you open the file in MS Excel. Please remove the restricted and encrypted info by yourselves, re-save the file, and then use Aspose.Cells to open it. It will work fine.