John Young
John Young

Reputation: 27

Unable to get POST request working in Excel custom functions

We are currently implementing custom functions in our app, and have been unable to get POST requests working.

What we have tried:

Are we missing an implementation detail? I read something brief about simple CORS, but wanted to reach out to see if there was a piece we are forgetting.

Upvotes: 1

Views: 497

Answers (2)

nmu
nmu

Reputation: 1519

I had this exact issue, I generated an excel add in using the yeoman generator and managed to make basic fetch requests, e.g using this famous example here: https://learn.microsoft.com/en-us/office/dev/add-ins/excel/custom-functions-web-reqs

However as soon as I added a headers field to a post fetch request my add in would fail on the windows version (but work fine on the web version).

As one of the comments mentions the answer is to make the plugin use the shared javascript runtime. Do I know what the shared javascript runtime is, or why Microsoft publishes documentation that doesn't work by default, no I do not to be honest I actually have really enjoyed most of the add in developer documentation but the web request stuff is a mess

Anyway if you follow the steps here: https://learn.microsoft.com/en-us/office/dev/add-ins/develop/configure-your-add-in-to-use-a-shared-runtime should work fine, at least it did for me.

Upvotes: 1

Wenbo Shi
Wenbo Shi

Reputation: 172

Are you testing on Excel for Windows, or Excel Online (aka Excel on the Web)? Currently full CORS is not supported yet in custom functions if you are running it in Excel for Windows. However it should work if you run it in Excel Online and Excel for Mac.

Upvotes: 2

Related Questions