Поделиться через


Using the Excel Services JavaScript API to Work with Embedded Excel Workbooks

In SharePoint 2010, Excel Services added support for ECMAScript (JavaScript, JScript). This enabled developers to automate, customize, and interact with an Excel Web Access Web Part control on a SharePoint page, but it was only available in SharePoint.

Now, you can embed a workbook stored on OneDrive into a <div> element on your host web page  and then manipulate the workbook programmatically, using the same Excel Services JavaScript API that is available for SharePoint 2010. So just using an Excel workbook stored on OneDrive, your web site, and the Excel Services JavaScript API, you can create cool apps like mashups using Bing Maps and embedded Excel workbooks!

To get started with this:

1. Store an Excel workbook on OneDrive in a Public folder.

2. Get the JavaScript embed code for embedding a workbook from the OneDrive Embed dialog box. (The Embed dialog is available from the Share button on the Excel ribbon when you open the workbook in browser view.)

3. Insert the embed code into the HTML of the host web page where you want to embed and manipulate the workbook.

4. Add your custom code to the host web page.

Embedded Excel + your web page + Excel Services JavaScript API == goodness!

For more information about how to accomplish this solution and more, see Using the Excel Services JavaScript API to Work with Embedded Excel Workbooks.