top of page
  • Writer's pictureAndyH

Opening a file in Excel

Updated: Mar 13, 2019


Opening a file in Excel or Excel Online is surprisingly easy

Today I needed to add a link that would open a document in Excel and I found two neat ways to do it.


On my web part I am showing a list of Excel files and I want to allow the user to open it. Back in older SharePoint I could either link to the file or hijack the JavaScript to open it directly in Excel to edit. On SharePoint Online with O365 I found a way to open in the browser with Excel Online and also in Excel.


Link to the file - just downloads


Using something like <a href={ item.filename }>Open Excel</a> where item.filename is the link to the file will simply download the file and nothing more. Not editing from the library.


Open in Excel Online


Searching through the Internet the first solution I found was to simply add ?web=1 to the end of the filename and this instructs SharePoint to open the file in the browser with Excel Online. Obviously the user must have access to Excel Online but this was easier than I anticipated.


Open in Excel (desktop)


I really wanted to open the file directly in the Excel app to allow the user to edit it there. This took a little more searching and I found this StackExchange solution which is to add

ms-excel:ofe|ofc|u| to the beginning of the address. Again, the obvious requirement is that the user must have the Excel application installed.


So there you have it, two painless ways to open an Excel file in either the browser or the application directly.

15 views0 comments

Recent Posts

See All
bottom of page