Walkthrough: Developing a Custom Application Using Excel Web Services
The walkthrough in this section describes the process for accessing Excel Web Services from an application created with Microsoft Visual C#.
During this walkthrough, you will learn how to:
Create a client application using the Microsoft Visual Studio 2005 Console Application project template.
Add a Web reference for Excel Web Services.
Write code to access the Web service. You will learn how to open a workbook, get the session ID, pass in the default credentials, get Web service version information, define the range coordinate object, get the range that uses the range coordinate object, close the workbook, and catch the SOAP exception.
Test and run the console application in debug mode.
A client console application is just one way to access the Web service. A more common way would be to use server applications, such as Microsoft ASP.NET applications. This walkthrough uses a console application example for simplicity, to focus on the Excel Web Services API aspects.
In order to complete this walkthrough, you will need:
Microsoft Office SharePoint Server 2007.
Microsoft Visual Studio 2003 or Microsoft Visual Studio 2005 or a similar Microsoft .NET Framework-compatible development tool.
Sufficient permissions (at the very least, "view" permissions) to be able to access Excel Web Services on the computer where Office SharePoint Server 2007 is located.
For more information about workbook permissions, see the following section, "Workbook Permissions."
A sample workbook installed on a local drive or local SharePoint document library.
A trusted location to store the workbooks that you want to access using Excel Web Services. If the workbooks are not stored in a trusted location, the Excel Web Services calls to open the workbook will fail. This walkthrough assumes the workbook is present on the local computer.
To create the workbook using Microsoft Office Excel 2007.
To save the workbook as .xlsx or .xlsb files.
The workbook used in this example has a worksheet named "Sheet1". The worksheet has 11 columns and 19 rows. Each cell from A1 to K19 contains a numeric value—for example, 4245.955, 6960.673, and so on.
To get the entire workbook (for example, by calling the GetWorkbook method), the caller needs "open" permission for the workbook.
To call the GetApiVersion method, no permission is necessary.
For the rest of the Excel Web Services methods, the caller needs "view" permission (in Windows SharePoint Services 3.0) or "read" permission (on a file share) for the workbook.
For more information about setting permissions, see the Windows SharePoint Services 3.0 documentation.
Other ResourcesStep 1: Creating the Web Service Client Project
Step 2: Adding a Web Reference
Step 3: Accessing the Web Service
Step 4: Building and Testing the Application
Accessing the SOAP API
How to: Trust a Location
How to: Trust Workbook Locations Using Script
Excel Services Alerts
Excel Services Known Issues and Tips
Loop-Back SOAP Calls and Direct Linking