Have you ever wanted to display an Excel workbook or a Word document on your website? Of course, it is possible to save files as HTML but it just doesn’t have the same feel. Fortunately Microsoft can actually come to the rescue. For example I have this sample spreadsheet that I created and then uploaded to my own website:

Even though the file is hosted here I can still view the contents in an IFRAME by using the following URL:

Here is the resulting IFRAME:

Believe it or not it is that simple to embed an office document on a webpage. If you want to do this you can simply use https://view.officeapps.live.com/op/embed.aspx?src= and append the URL to your Office document so that it is passed as the src parameter. There are additional parameters that you can define if you want. To find these options you can use the option in the bottom-right corner to view in full-size mode and then in the main menu select File » Share » Embed.

Embed Full View

It is also possible to either link to the full view which includes the menus. To do this instead of the path to their service being …embed.aspx?src=… you can use …view.aspx?src=…. Here is an example of the link and the corresponding IFRAME:

Embed PowerPoint Presentations

Being able to embed Word documents and Excel spreadsheets is great, but being able to also embed PowerPoint presentations is even cooler:

Final Words

There are probably other free APIs out there that provide the same functionality so if you know of one let us know in the comments below. As always, happy coding! šŸ˜Ž

Leave a Reply

Your email address will not be published. Required fields are marked *