Export (0) Print
Expand All

Walkthrough: Developing a Custom Application Using Excel Web Services

Last modified: July 20, 2011

Applies to: Office 365 | Word

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 Visual Studio 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 SharePoint Server 2010.

  • Visual Studio 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 SharePoint Server 2010 is located.

    Note Note

    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.

    Note Note

    For information about how to trust a location, see How to: Trust a Location and How to: Trust Workbook Locations Using Script.

  • To create the workbook using Excel.

  • 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 fr 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 Microsoft SharePoint Foundation) or "read" permission (on a file share) for the workbook.

    Note Note

    For more information about setting permissions, see the SharePoint Foundation documentation.

Show:
© 2014 Microsoft