none
How to get metadata document properties of excel file when workbook is protected? RRS feed

  • Question

  • I'm trying to set and get the metadata document properties of a excel file. When the workbook is protected, the metadata are not accessible and cannot be set. Is there any way around this because the workbook in my file needs to be protected ect.

    Thursday, October 27, 2016 1:37 PM

All replies

  • Hi,

    If the file is protected, I think we could use Open XML SDK Library to get the metadata you need.

    Please visit the similar thread: Get Internal Metadata for Excel File

    If you have any issues about how to apply the code to your file, please feel free to post here.

    Besides, for more information about the Open XML SDK, you could visit Spreadsheets (Open XML SDK)

    As for the issue about how to set the metadata, how do you protect the workbook?

    Please share more information, we could try to reproduce and check if the properties could be modified by using Open XML SDK.

    Regards,

    Celeste 


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, October 28, 2016 2:53 AM
    Moderator
  • If you set the properties when the excel file has not been protected, you will see the metadata for it, it's just when it is protected or after it is protected that the values are not accessible.

    The excel workbook is protected by password when you go into the tab "Review" and protect sheet or protect workbook. Save the excel workbook and close it. From the document explorer, go to the file and right click> properties> detail tab and look at the properties. None of the properties will show that it have any metadata filled out but if you unproptect the workbook, you will see the values. Just wondering if there is a way around it since all my workbook needs to be workbook protected but i want to be able to access some information on that file without having to unprotect workbook ect.

    Friday, October 28, 2016 12:52 PM
  • Hi,

    I followed your steps to protect the workbook: in Review tab, click Protect Workbook, enter the password, then check the Properties of the file in the Document Explorer, I could still see the properties like author, title, and I could edit them.

    In fact, if you set Protect Workbook, the workbook is locked to change about sheets moving/deleting/adding.


     

    Could you please share us a sample file which you are unable to see the properties?

    You could upload the file to OneDrive and paste the URL here.

    Besides, what metadata do you want to read and change?

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Saturday, October 29, 2016 9:42 AM
    Moderator
  • Hi, please lock the sheet and workbook. Close the whole file and reopen it. Are you still able to see the properties? I only want "Comment" properties to add a tag to the file. Attach is a example file. Once close if you open the file properties by right click file> properties > detail> do you see the properties there?

    Excel Example

    Monday, October 31, 2016 1:08 PM
  • Hi,

    The file could be opened and I think the file is encrypted by a password (see Picture1)

    Unfortunately, if the workbook is encrypted, we are unable to get anything,

    If you only protect workbook and Sheet in the Review Tab(see Picture2), the properties are visible and apparently we could get them.

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, November 1, 2016 7:28 AM
    Moderator