Skip to Content

How to consume Excel URL fin sapui5

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)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Nov 25, 2016 at 04:01 PM

    remvoe your code and try this after get the fileurl

    var encodeUrl=encodeURI(fileURL);


    Add comment
    10|10000 characters needed characters exceeded