Question
Data Coffee on Thu, 28 Jan 2016 13:29:16
In an Excel add-in (based on office.js instead of VSTO), I had the following code that makes a RESTful web service call.
$.getJSON("http://jsonplaceholder.typicode.com/posts/", function (data) {
$("#signin-status").html(data);
})
When running on a standalone .html file, it worked fine and CORS just works. However, it fails when running inside Excel add-in. The call back "function (data)" is never called. From fiddler, there is no trace of HTTP request to http://jsonplaceholder.typicode.com/posts/ at all.
From reading office.js documents, CORS should just work, but it is not working for me. Could you let me know what I missed? Thanks!
Replies
Fei Xue on Fri, 29 Jan 2016 07:30:44
Hi,
Any locally stored HTML file to access all other files on the disk, or communicate with any site on the Internet. It means, there is same-origin policy limitations for the file on the disk.
To address same-origin policy limitations in Office Add-ins, you can refer to the link below:
Addressing same-origin policy limitations in Office Add-ins
Regards & Fei
G00golplex on Tue, 22 May 2018 06:48:47
Hi,
Concerning the link you have posted, there is no information at all how to simply do a web request which pulls data from a website. Like Data coffee said, it does not do anything. Didn't you Geniuses at Microsoft think of a possibility that a user has to pull data from a web service somehow? The funny thing is that if you go to Excel->Data->from web and use the interface you get your web request result but if you try to do this with a XMLhttpRequest you just get zilch! So is there no possiblity that the Excel JS API communicates with the built-in function of excel so i could finally get my data from a web service?
Many Thanks
Lif' on Mon, 16 Nov 2020 22:32:40
Hi,
I'm facing the same issue. Rather annoying.
Have you found a solution?
Thanks