Excel Services: Saving Workbooks back to the Server

Clients have recently asked questions about Saving workbooks back to the server. In Excel Services, there are several ways to save back to the server. However, the two simplest ways to do it are:

  1. Open in Excel (or Snapshot) using the Client, modify the file, and save it back to the server
  2. Write it back programmatically

Business Scenario:

Nancy is a Chief Information Officer for an Aerospace Engine manufacturer that travels frequently across the world in order to coordinate IT activities and delegate responsibilities. She uses an Excel Spreadsheet to keep track of what each department is responsible for. Since she changes between multiple laptops, she does not keep a local copy of a workbook on any specific computer. This is to prevent her from mistakenly overwriting existing changes she may have made on multiple computers (One-Version-Of-The-Truth). As a result, she has always reliably depended on Excel Services to display and store her workbooks. However, from time to time, she decides to delegate different activities across regional teams and needs to edit a workbook. In these cases, she opens the workbook in Excel and Saves the workbook back to the server in order to maintain a single copy of the truth. How can this be achieved?

How can we Save?  

Method 1: User Interface (Excel)

This is probably the simplest and most popular way users will be saving back to the server.

  • Open the workbook in Excel (or in Snapshot)
  • Edit the workbook
  • Save the workbook in the client back to the server

 Method 2: Programmatically Save As via Excel Client

In some cases, some users might be interested in opening, editing, and saving the workbook back to the server programmatically via Excel Client. Here is some example code that I wrote really quickly to give you an idea (Please tailor this code to your need and do not use it as reliable production code).

SaveAsAppforBlog

Method 3: Programmatically via Excel Services using Binary Writer

This method was documented in MSDN and works pretty well.

 

Once again, if you have any suggestions or comments on how we could make Excel Services exceed your expections, let me know. I love hearing from you.