0

We have this issue around saved settings when we share workbooks among users. When we share workbooks, we sometimes notice that the saved settings are lost when the workbook is open by a different user using the same version of the add-in. We understand that this could happen when sideloading the add-in using the shared folder. However, when we use the AppSource, we observe settings are lost when a user creates the workbook from an add-in installed from in-app (get add-in option in Excel) and shared it with someone who installed the add-in from the office store (web).

Could someone explain what the dependencies are when we use Excel API to save and read settings?

This is how we save settings:

 saveData(data) {
      try {
        Office.context.document.settings.set("presets", JSON.stringify(data));
        Office.context.document.settings.saveAsync();
      } catch (e) {
        console.error(e);
      }
  }

This is how we read settings:

  getSavedData() {
    return JSON.parse(Office.context.document.settings.get('presets'));
  }
  • it seems you are working with add-ins from 2 different source(one from appsource, another from office store). will this issue repro if you both 2 add-in is from the same source? – Raymond Lu Apr 26 '21 at 14:55

1 Answers1

0

Thanks for your question, the method refreshAsync is recommended to read settings, you can try this:

Office.context.document.settings.refreshAsync((result: Office.AsyncResult<Office.Settings>) => {
      savedData = result.value.get('presets');
});

Thanks, Office Platform team.