Earlier if any Excel need to be embedded in a page, user had to use Excel Web Access Webpart and set the property to point to Excel. Now it has become much simpler and more powerful. Just by copying the URL with adding few parameters and using the URL in iframe HTML tag is all required to embed it in a page.
I'm going to show you this in simple 3 steps.
Step 1: Prepare an Excel.
I used Microsoft provided Excel template for this demo. I saved this excel directly to a SharePoint library.
Step 2: URL manipulation
Click on the document to open it within browser. Copy the URL from browser and paste it in a Notepad.
Replace the parameter from "action=default" to "action=embedview" and add another parameter wdbipreview=true.
So your URL looks something like this (you have changed only highlighted ones).
I'm going to show you this in simple 3 steps.
Step 1: Prepare an Excel.
I used Microsoft provided Excel template for this demo. I saved this excel directly to a SharePoint library.
Excel Workbook |
Save to Library |
Step 2: URL manipulation
Click on the document to open it within browser. Copy the URL from browser and paste it in a Notepad.
Replace the parameter from "action=default" to "action=embedview" and add another parameter wdbipreview=true.
So your URL looks something like this (you have changed only highlighted ones).
http://[your domain]/sites/[your Site Collection]/_layouts/15/WopiFrame.aspx?sourcedoc=xxxxx&file=Project%20timeline%20with%20milestones.xlsx&action=embedview&wdbipreview=true
Now we'll put this URL in an iFrame tag.
<iframe src="Your URL" height="550" width="900"></iframe>
Step 3: Paste the URL in a page
Navigate to Page library and create a page (I provided Title as Excel Dashboard).
Click on Edit Source as shown below.
Edit Source of Page |
Paste the URL and Save Page.
Now, the page looks like this.
Excel embedded |
More parameters:
There are quite a number of parameters which can be used in the URL. For example, you can add Download button, you can hide Excel gridlines, allow interactivity etc.
For more information about these parameters, click here.
Update [13-May-2016]: The above link is broken. Thanks to Josh for pointing it out. Similar article can be found here. However this article is for "guest" access and not sure if the parameters work for WopiFrame.aspx page as well. I have not tried yet. If I get time to play around these, will update back here.
I'm trying to find a URL parameter that allows me to view the full page. Your link to the parameters sounds very helpful but it is broken.
ReplyDelete.
ReplyDeleteJosh, looks like Microsoft has taken out that link. Similar article is available at https://support.office.com/en-us/article/Embed-your-Excel-workbook-on-your-web-page-or-blog-from-SharePoint-or-OneDrive-for-Business-7af74ce6-e8a0-48ac-ba3b-a1dd627b7773
ReplyDeleteThough this link describes for a "guest" access, you can try if the parameters work in the above case as well.
Hello Suresh,
ReplyDeleteVery informative post.
Can you list down other parameters too or reference?
Thank you
Asif
@Anonymous, When I had written this article, there was a reference article from Microsoft which had the details of parameters. Unfortunately, that article seems to be taken out. I do not have any other reference links.
Delete