Skip to Content
Nov 25, 2016 at 01:59 PM

How to consume Excel URL fin sapui5

218 Views Last edit Nov 28, 2016 at 05:39 PM 4 rev

Hi Everyone,

I have requirement, where from backend they are providing Excel link on click of button in UI I should consume that URL and download that Excel.

I wrote below code on click of Button. I am taking URL into fileURL variable but I am unable to download .

var oModel = new sap.ui.model.odata.ODataModel(CONSTANTS.BUPA_ODATA,true); 
var sRead = "/DownloadSet" ; sRead, null, null, true, function(oData, oResponse){ 
 console.log(oData); var fileURL = oData.results[0].url; 
 var link = document.createElement("a"); 
link.href =  fileURL ; = "visibility:hidden"; = fileURL ; //this part will append the anchor tag and remove it after automatic click document.body.appendChild(link);; document.body.removeChild(link);
function(){ alert("Read failed"); }); 

It's Downloading Excel with No file.

My Odata service looks as attached and in that Property URL having Excel link.

Could anyone please help how to get that exact URL and download excel in SAPUI5.

Gatewayserver giving Excel


Best Regards,



noexcel.png (2.1 kB)
service.png (83.5 kB)
excel.png (81.0 kB)