0

Implemented excel addin custom functions which are working in online version (windows/mac) and desktop version (MAC) . Custom functions are failing in windows desktop version.

Verified the desktop office build number and it's supported as per the Microsoft docs.

Each implemented custom function will invoke a server call.

Further debugging got the "TypeError: Network request failed" error. Not sure why it's failing only in windows desktop excel.

Following in the manifest

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OfficeApp 
   xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" 
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
   xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/
    1.0"
  xmlns:ov=
"http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">
  <Id>0e97108b-0e3b-484c-9ee8-24c4ac0e0eb8</Id>
  <Version>1.0.0.0</Version>
  <ProviderName>CFS</ProviderName>
  <DefaultLocale>en-US</DefaultLocale>
  <DisplayName DefaultValue="CFS"/>
  <Description DefaultValue="CFS functions"/>
  <IconUrl DefaultValue="https://localhost:3000/assets/FS- 
   Favicon.png"/>
  <HighResolutionIconUrl 
    DefaultValue="https://localhost:3000/assets/FS-Favicon.png"/>
  <SupportUrl DefaultValue="https://www.cfs.com/help"/>
  <AppDomains>
   <AppDomain>https://www.cfs.com</AppDomain>
  </AppDomains>
  <Hosts>
   <Host Name="Workbook"/>
  </Hosts>
  <Requirements>
   <Sets DefaultMinVersion="1.1">
   <Set Name="CustomFunctionsRuntime" MinVersion="1.1"/>
  </Sets>
</Requirements>
<DefaultSettings>
   <SourceLocation 
    DefaultValue="https://localhost:3000/taskpane.html"/>
 </DefaultSettings>
 <Permissions>ReadWriteDocument</Permissions>
 <VersionOverrides xmlns="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="VersionOverridesV1_0">
  <Hosts>
  <Host xsi:type="Workbook">
    <!-- <Runtimes>    
      <Runtime resid="CFS.Functions.Url" lifetime="long" />
    </Runtimes> -->
    <AllFormFactors>
      <ExtensionPoint xsi:type="CustomFunctions">
        <Script>
          <SourceLocation resid="Functions.Script.Url"/>
        </Script>
        <Page>
          <SourceLocation resid="Functions.Page.Url"/>
        </Page>
        <Metadata>
          <SourceLocation resid="Functions.Metadata.Url"/>
        </Metadata>
        <Namespace resid="Functions.Namespace"/>
      </ExtensionPoint>
    </AllFormFactors>
    <DesktopFormFactor>
      <GetStarted>
        <Title resid="GetStarted.Title"/>
        <Description resid="GetStarted.Description"/>
        <LearnMoreUrl resid="GetStarted.LearnMoreUrl"/>
      </GetStarted>
      <FunctionFile resid="Commands.Url"/>
      <ExtensionPoint xsi:type="PrimaryCommandSurface">
        <CustomTab id="CFS.Tab">
          <Group id="CFS.Tab1.Group1">
            <Label resid="CFS.Tab1.GroupLabel" />
            <Icon>
              <bt:Image size="16" resid="Icon.16x16"/>
              <bt:Image size="32" resid="Icon.32x32"/>
              <bt:Image size="80" resid="Icon.80x80"/>
            </Icon>
            <Control xsi:type="Button" id="CFS.FunctionsButton">
              <!-- <OverriddenByRibbonApi>true</OverriddenByRibbonApi> -->
              <!-- <Enabled>false</Enabled> -->
              <Label resid="CFS.FunctionsButton.Label" />
              <Supertip>
                <Title resid="CFS.FunctionsButton.Label"/>
                <Description resid="CFS.FunctionsButton.Tooltip"/>
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="functions.16x16"/>
                <bt:Image size="32" resid="functions.32x32"/>
                <bt:Image size="80" resid="functions.80x80"/>
              </Icon>
              <Action xsi:type="ShowTaskpane">
                <TaskpaneId>ButtonId1</TaskpaneId>
                <SourceLocation resid="CFS.Functions.Url"/>
              </Action>
            </Control>  
            <Control xsi:type="Button" id="CFS.AccountButton">
              <Label resid="CFS.AccountButton.Label" />
              <Supertip>
                <Title resid="CFS.AccountButton.Label"/>
                <Description resid="CFS.AccountButton.Tooltip"/>
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="account-management.16x16"/>
                <bt:Image size="32" resid="account-management.32x32"/>
                <bt:Image size="80" resid="account-management.80x80"/>
              </Icon>
              <Action xsi:type="ExecuteFunction">
                <FunctionName>manageAccount</FunctionName>
              <!-- <Action xsi:type="ShowTaskpane"> -->
                <!-- <TaskpaneId>ButtonId1</TaskpaneId> -->
                <!-- <SourceLocation resid="CFS.Account.Url"/> -->
              </Action>
            </Control>
          </Group>
          <Label resid="CFS.Tab.TabLabel" />
        </CustomTab>
        <!-- <OfficeTab id="TabHome">
          <Group id="CommandsGroup">
            <Label resid="CommandsGroup.Label"/>
            <Icon>
              <bt:Image size="16" resid="Icon.16x16"/>
              <bt:Image size="32" resid="Icon.32x32"/>
              <bt:Image size="80" resid="Icon.80x80"/>
            </Icon>
            <Control xsi:type="Button" id="TaskpaneButton">
              <Label resid="TaskpaneButton.Label"/>
              <Supertip>
                <Title resid="TaskpaneButton.Label"/>
                <Description resid="TaskpaneButton.Tooltip"/>
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="Icon.16x16"/>
                <bt:Image size="32" resid="Icon.32x32"/>
                <bt:Image size="80" resid="Icon.80x80"/>
              </Icon>
              <Action xsi:type="ShowTaskpane">
                <TaskpaneId>ButtonId1</TaskpaneId>
                <SourceLocation resid="Taskpane.Url"/>
              </Action>
            </Control>
          </Group>
        </OfficeTab> -->
      </ExtensionPoint>
    </DesktopFormFactor>
  </Host>
</Hosts>
<Resources>
  <bt:Images>
    <bt:Image id="Icon.16x16" DefaultValue="https://localhost:3000/assets/icon-16.png"/>
    <bt:Image id="Icon.32x32" DefaultValue="https://localhost:3000/assets/icon-32.png"/>
    <bt:Image id="Icon.80x80" DefaultValue="https://localhost:3000/assets/icon-80.png"/>

    <bt:Image id="functions.16x16" DefaultValue="https://localhost:3000/assets/functions-16.png"/>
    <bt:Image id="functions.32x32" DefaultValue="https://localhost:3000/assets/functions-16.png"/>
    <bt:Image id="functions.80x80" DefaultValue="https://localhost:3000/assets/functions-16.png"/>

    <bt:Image id="account-management.16x16" DefaultValue="https://localhost:3000/assets/account-management-16.png"/>
    <bt:Image id="account-management.32x32" DefaultValue="https://localhost:3000/assets/account-management-16.png"/>
    <bt:Image id="account-management.80x80" DefaultValue="https://localhost:3000/assets/account-management-16.png"/>
  </bt:Images>
  <bt:Urls>
    <bt:Url id="Functions.Script.Url" DefaultValue="https://localhost:3000/dist/functions.js"/>
    <bt:Url id="Functions.Metadata.Url" DefaultValue="https://localhost:3000/dist/functions.json"/>
    <bt:Url id="Functions.Page.Url" DefaultValue="https://localhost:3000/dist/functions.html"/>
    <bt:Url id="GetStarted.LearnMoreUrl" DefaultValue="https://go.microsoft.com/fwlink/?LinkId=276812"/>
    <bt:Url id="Commands.Url" DefaultValue="https://localhost:3000/commands.html"/>
    
    <!-- <bt:Url id="Taskpane.Url" DefaultValue="https://localhost:3000/taskpane.html"/> -->
    <bt:Url id="CFS.Functions.Url" DefaultValue="https://localhost:3000/dist/cfs.html"/>
    <bt:Url id="CFS.Account.Url" DefaultValue="https://localhost:3000/dist/cfs-auth-management.html"/>
  </bt:Urls>
  <bt:ShortStrings>
    <bt:String id="Functions.Namespace" DefaultValue="CFS"/>
    <bt:String id="GetStarted.Title" DefaultValue="CFS add-in!"/>
    <!-- <bt:String id="CommandsGroup.Label" DefaultValue="Commands Group"/> -->

    <bt:String id="CFS.Tab.TabLabel" DefaultValue="CFS"/>
    <bt:String id="CFS.Tab1.GroupLabel" DefaultValue="Manage CFS"/>
    <bt:String id="CFS.FunctionsButton.Label" DefaultValue="Insert Functions"/>
    <bt:String id="CFS.AccountButton.Label" DefaultValue="Manage Account"/>
  </bt:ShortStrings>
  <bt:LongStrings>
    <bt:String id="GetStarted.Description" DefaultValue="Loaded succesfully."/>
    <bt:String id="TaskpaneButton.Tooltip" DefaultValue="Click to Show a Taskpane"/>

    <bt:String id="CFS.FunctionsButton.Tooltip" DefaultValue="Click to view functions"/>
    <bt:String id="CFS.AccountButton.Tooltip" DefaultValue="Manage Account"/>
  </bt:LongStrings>
</Resources>

Any help, why it's only failing only in windows desktop office excel.

6
  • Did you notice any error? May you please share the desktop Excel version (Excel->Account->About Excel)? It would be great if you can share the manifest file which is much helpful for debugging. Commented May 8, 2021 at 1:18
  • Windows excel version 2104 (Build 13929.20296). Updated the description with manifest. No errors. Commented May 8, 2021 at 3:38
  • On further debugging, "TypeError: Network request failed" error is blocking this functionality. Not sure why only this is happening in windows desktop excel. Commented May 9, 2021 at 11:41
  • Looks like your local loopback is disabled. You'll need to enable a local loopback exception. Details please refer to: learn.microsoft.com/en-US/office/troubleshoot/… Commented May 10, 2021 at 1:36
  • It didn't worked. The issue seems to be with CORS request in excel custom functions. Trying to implement sharedRuntime as stated at learn.microsoft.com/en-us/office/dev/add-ins/develop/…. Commented May 10, 2021 at 4:30

1 Answer 1

2

I know it's late to answer this post, but I'm new to this myself and I had the exact same error. To fix this problem I changed from 'CustomFunctionsRuntime' to 'SharedRuntime' by following this guide: https://learn.microsoft.com/en-us/office/dev/add-ins/develop/configure-your-add-in-to-use-a-shared-runtime.

According to other people this will give some limits to your custom functions, but I didn't notice any right away and solved even other problem I had such as not having a TextDecoder. It's probably too late help you, but I hope I can help other people with the same problem.

Kind regards Sven

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.