Handling office.js worksheet import issues with "extension hardening" level 2

Thiemo Reichard 0 Reputation points
2025-01-06T12:28:28.02+00:00

Hello,

we stumbled upon a problem with our Excel Add-in recently and are a little stumped. We are creating excel worksheets using Excel.createWorkbook() and insertWorksheetsFromBase64() to import data from a third party API into excel.

For security reasons however, some clients prefer to set their local policies "Force file extension to match file type" to strict (2; always match file type), within the excel security policies, which breaks the office.js functions used here. This issue is always present and seems to be by design judging from the answers in this Github issue.

Unfortunately, setting the policy to 1 (Allow different, but warn) is not enforceable in this case. Are there other options to facilitate similar functionality in the javascript API which does not trigger this security behavior?

To reproduce this issue, any add-in using the mentioned functionality with a strict extension hardening policy (level 2) should be sufficient, regardless of office.js-version or excel version as long as they are compatible (older office.js versions might outright crash the application; newer versions handle the exception).

The goal would be to enable worksheet creation from xlsx-documents which should not trigger the extension hardening policy, either by working around the security-policy or by using alternative functions that conform to the policy.

Thank you in advance!

Excel
Excel
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
2,073 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
1,019 questions
Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
4,141 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.