Search code examples
exceloffice-jsoffice-addinscustom-functions-excelexcel-web-addins

Is there a way to determine if Shared Runtime is used?


I am working to migrate an Excel Add-in from the old Custom Functions runtime to the new Shared Runtime. We have noticed some of our users don't receive the updated manifest as quickly as others. Therefore, there will be a cross-over period where some of our users have the Shared Runtime manifest and others use the old Custom Functions Runtime manifest. We need some way to detect who's actually running the Shared Runtime, and who's not.

We've found checking isSetSupported('SharedRuntime') returns true, even if the shared runtime is not set in the manifest (particularly on Mac/Online).

Is there a way in the OfficeJS API to determine if the Shared Runtime is active and being used?


Solution

  • The isSetSupported('SharedRuntime') method just tells you if the Office version supports shared runtime in principle. It doesn't tell you if the add-in is configured to use a shared runtime.

    If a shared runtime is being used, then global variables are shared between the custom function and whatever other add-in feature, such as a task pane, is using the same runtime. I think you can use this to test if a shared runtime is being used. Have the other feature set a global variable on startup (say, in the Office.onReady or Office.initialize method). Then have code in the custom function check if the variable is defined and has the value the other feature set.