I'm working on a spfx app in reactjs and need to open an excel file. Does anyone know the best way to do this?

now i'm using window.open(d.ServerRelativeUrl, '_blank'); but this downloads the file and i dont want that.

I need it to open in excel app not in browser it is connected with a vsto add-in


You should append the query string ?web=1 to the ServerRelativeUrl.

It will open the file in the browser instead of downloading the file.

Modify your method as below:

window.open(d.ServerRelativeUrl + '?web=1','_blank')

  • Sorry i forgot to mention that the excel has a vsto addin so i need to open it in excel app. – link May 29 '18 at 6:19

Found the solution at microsoft docs here

So in my case the answer was : "ms-excel:ofe|ofc|u|https://[yoururl]"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.