How can I programmatically modify an Excel file with AIP sensitivity tags?

42 views (last 30 days)
My company has recently decided to make Excel create files automatically with Azure Information Protection (AIP) sensitivity labels. We have programs in MATLAB that modify Excel files, but because of this, they have started to fail when trying to modify the files. Specifically, when using the writetable function, MATLAB shows the following error:
Unable to write to file 'D:\Prueba xlswrite\Benchmark_Colones_1-2años_31-03-2024.xlsx'.
Ensure the file is a valid spreadsheet file and is not password protected.
Is there a way to programmatically provide the credentials needed by Excel to be able to modify the file when it is allowed?

Answers (1)

Poorna
Poorna on 3 Jun 2024
Hi Ricardo,
I see you are facing errors while modifying excel files that have AIP labels using the "writetable" function.
I suggest you to use COM server functionality provided by MATLAB to make modifications to files for this requirement. You can use the "actxserver" function to create a COM server and use it to read and modify your excel files. These functions provide you much more customizations and settings while reading and writing to Microsoft documents.
Refer to the following documentation to learn more about "actxserver":
Refer to the following documentation demonstrating, reading and writing to excel files using the server:
Refer to the following MATLAB answer that has example code to modify the AIP tags as well:
Hope this Helps!

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!