Workbooks, Worksheets and Passwords

Posted by: brooksby on 9 November 2017, 2:51 am EST

    • Post Options:
    • Link

    Posted 9 November 2017, 2:51 am EST

    I have an Excel workbook I’m trying load using the Spread.Excel.IO.open() function. The workbook contains only one worksheet and the worksheet is password protected. I know the password.

    If I try to open the workbook without providing the password, I receive and error message, as I should. The error code is “1” and the error message says, “Incorrect file format”. This message is not as descriptive of the problem as I would hope, but I can live with it.

    However, if I then provide the password via the options argument, I get the same error. So I am unable to open the workbook/worksheet.

    I know that Excel provides at least 3 ways to password protect workbooks or worksheets.

    1. You can apply a password to a worksheet.
    2. You can provide a password to open the workbook using Save As…->Tools->General Options.
    3. You can provide a password to modify the workbook using Save As…->Tools->General Options.

    There may be more because there are different ways to access workbook/worksheet protection attributes and I’m not sure if they yield the same results.

    However, the Spread.Excel.IO.open() only provides one “password” option.

    Can someone please tell me which password is intended for Spread.Excel.IO.open()?

    Also, while there is password protection on my worksheet, it only applies to some of the cells. Others are editable. Can you tell me how to properly load this worksheet so I may edit the proper cells?

    Thanks.

  • Posted 10 November 2017, 2:50 am EST

    Hello,

    Currently Spread.Sheets works for the Workbook level passwords set for protection. Also when a wrong password is used the ErrorCode used by Spread.Sheets Excel IO is ‘2’ i.e. “invalidPassword”.

    When you have Password protection On for the sheet then you can only edit the cells which are not locked.

    So make sure that you have the Locked property for the cells set to True in order to being able to edit all cells.

    http://help.grapecity.com/spread/SpreadSheets10/webframe.html#sccelllock.html

    Thanks,

    Deepak Sharma

  • Posted 13 November 2017, 2:57 am EST

    Thanks for your reply Deepak. You said to “make sure that you have the Locked property for the cells set to True in order to [be] able to edit all cells”. This seems to be the opposite from what I would expect. If Locked = true, I would think I could not edit cells. Am I reading this wrong?

  • Posted 13 November 2017, 8:19 pm EST

    Hello,

    Sorry, that was a typing error. You need to set the Locked Property of the cells to False in order to being able to edit those cells when you have sheet protection set to True.

    Please check this documentation link:

    http://help.grapecity.com/spread/SpreadSheets10/webframe.html#sccelllock.html

    Thanks,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels