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

3 Answers 3


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, 2018 at 6:19

Found the solution at microsoft docs here

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


When using that method I still get an alert popup like this (Word shown in image, but same goes for all document types): enter image description here

Is there any way to avoid this? I see in the browser console, that when opening the file directly from the out-of-the-box list view, there is this message: Launched external handler for 'ms-word:ofe%7C

What is this "external handler" and can it be launched from my SPFx code?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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