SheetJS / sheetjs

📗 SheetJS Spreadsheet Data Toolkit -- New home https://git.sheetjs.com/SheetJS/sheetjs

Home Page:https://sheetjs.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to set classification (Unrestricted, Restricted, Confidential, Strictly Confidential)

Nikhilrj22 opened this issue · comments

Hi,

I have one requirement where I need to classify the document based on the data, I am exploring using this library how to set the excel with confidential type.

Any help would be appreciated.

Thanks
Nikhil

You're describing "Sensitivity Labels". https://docs.microsoft.com/en-us/microsoft-365/compliance/sensitivity-labels?view=o365-worldwide starting point.

The whole feature is cloud-based and relies on Azure services. There are no plans to add network requests to the library, so general support is out of the question.

According to the specs, it might suffice to set the Sensitivity custom property of the workbook to a specific GUID:

  • Create a file with the desired setting (and if you can share it, that would be appreciated :)
  • Go to https://jsfiddle.net/kna9L73j/2/ and use the file input element to select your file. The props in the file will be displayed. It runs in your browser (no data leaves your machine)
  • If there is a "Sensitivity" key, copy the value into your worksheet before writing. Assuming wb is your workbook:
if(!wb.Custprops) wb.Custprops = {};
wb.Custprops.Sensitivity = "GUID_FROM_TEST_FILE"
// XLSX.writeFile ...

Please try that and let us know if it works. If it does, we can update the docs.

Thanks for your response.

I am creating a excel sheet using below code.

        const workBook = XLSX.utils.book_new();

        const workSheet = XLSX.utils.json_to_sheet(jsonResponse);

        XLSX.utils.book_append_sheet(workBook, workSheet);

        XLSX.writeFile(workBook, fileName);

I want to set the classification as "Confidential" for this file.

With your above suggested solution I tried to give

wb.Custprops.Sensitivity = "Confidential";

with this setting, downloaded file is always opening in protected mode. I need to set this as confidential.

Could you please help me, what GUID I should set to make the file as "Confidential" or how to explicitly set the file as "Confidential"

Thanks
Nikhil

According to the documentation, sensitivity labels requires Azure as well as specific enterprise versions of Excel (it is disabled in our instances). So the best we can realistically do without requiring network access is to pull properties from existing files and use them in new ones.

Create a new file in Excel with the Confidential sensitivity. Then you can share it here OR use https://jsfiddle.net/vocLhaek/ (this version prints all of the normal properties and custom properties)

According to the spec, there may be a Sensitivity property which may be a GUID.

If you can share a sample file, we can take a closer look and reopen the issue.