In SharePoint 2013, sometimes we need to embed document so that we can use it on page or blog at load time where other people can view and interact with them without having to log into SharePoint Online.
You can get URL of hosted document and use it embed directly in your web page and blog by setting src attribute in <iframe> tag in your web page.
Steps to open document in <iframe> tag
- Click on document in browser.
- Copy and paste url on notepad.
https://abc.sharepoint.com/spapps/mstest2/_layouts/15/WopiFrame.aspx?sourcedoc=%7B68741B12-7419-4580-8904-0EAB510ECC8F%7D&file=Test_Exel.xlsx&action=default
- Replace url parameter action=default with URL parameter action=embedview at the end of the url string. so document will open without header.
- To allow interactivity with filters and Pivot tables in the document, add the url parameter &wdAllowInteractivity=True.
- To have BI features such as Power View visualizations, PivotTables, and Data Model-based slicers work in the embedded document, add the string &wdbipreview=True.
- To open ducument in callout popup specify parameter &action=interactivepreview&wdSmallView=1
Note: Final url should similar to this one
https://abc.sharepoint.com/spapps/mstest2/_layouts/15/WopiFrame.aspx?sourcedoc=%7B68741B12-7419-4580-8904-0EAB510ECC8F%7D&file=Test_Exel.xlsx&action=embedview&ActiveCell=C5
Specify src attribute with above url in iframe tag with width, height, frameorder and scrolling attribute.
For additional excel parameter visit Microsoft documentation.