Error: “The workbook cannot be opened" when opening Excel Workbook in browser

Hello All,

I was recently working with a customer on an issue with SharePoint 2010 Excel Services, everytime they opened an Excel Workbook in the browser they got the following error message:

“The workbook cannot be opened”

But if they opened the Workbook in the desktop client they had no problems with it.

Based on this error we found the following article KB981293 which provides you a solution based on the fact that the Service account for Excel Services needs db_owner.. It provides the following PowerShell commands to make this happen

$w = Get-SPWebApplication –Identity <URL of the Web application>
$w.GrantAccessToProcessIdentity("<insert service account>")

After we ran these commands we verified with the DBA and the permissions had been corrected, we then tested with an Excel Workbook but got the same error.  But when we uploaded a new workbook we were able to open it in the browser.

Then we further tested this and discovered that if we deleted the Workbook or Document Library and recreate/Upload them we got the same error, but if we deleted and then changed the name when recreated.  We would be able to open the workbook in the browser.

I then started digging around and found a write-up done by an old co-worker Josh R(joroar) that looked like it fit the situation.  Here are the important part of it:

Errors in ULS logs

Excel Services Application      Excel Calculation Services           tufa      Medium           SharePointFileLoader.GetSPFile: Sharepoint threw a handled exception - turning it into a FileOpen exception. Exception is: System.Runtime.InteropServices.COMException (0x800703FA): Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 800703fa.     at Microsoft.SharePoint.Library.SPRequest..ctor()     at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)     at Microsoft.SharePoint.SPSite.GetSPRequest()     at Microsoft.SharePoint.SPSite.get_Request()     at Microsoft.SharePoint.SPSite.SetAllowUnsafeUpdates(Boolean allowUnsafeUpdates)     at Microsoft.Office.Excel.Server.MossHost.SharePointHelperMethods.GetSite(String fileLocation, IClaimsIdentity claimsIdentity)     at Microsoft.Office.Excel.Server.MossHost.MossHostFileLoader.GetSPFile(IClaimsIdentity claimsIdentity)     f7318750-b8fd-42c0-ad99-24e3bc9ccebe

Excel Services Application      Excel Calculation Services           2023    Information     Failed to load 'https://<Path to the xlsx file>' with error: 'Unable to open workbook due to unexpected exception: Microsoft.Office.Excel.Server.Host.HostFileException ---> System.Runtime.InteropServices.COMException (0x800703FA): Retrieving the COM class factory for component with CLSID {BDEADF26-C265-11D0-BCED-00A0C90AB50F} failed due to the following error: 800703fa.     at Microsoft.SharePoint.Library.SPRequest..ctor()     at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)     at Microsoft.SharePoint.SPSite.GetSPRequest()     at Microsoft.SharePoint.SPSite.get_Request()     at Microsoft.SharePoint.SPSite.SetAllowUnsafeUpdates(Boolean allowUnsafeUpdates)     at Microsoft.Office.Excel.Server.MossHost.SharePointHelperMethods.GetSite(String fileLocation, IClaimsIdentity claimsIdentity)     at Microsoft.Office.Excel.Server.MossHost.MossHostFileLoader.GetSPFile(IClaimsIdentity claimsIdentity)     --- End of inner exception stack trace ---     at Microsoft.Office.Excel.Server.MossHost.MossHostFileLoader.GetSPFile(IClaimsIdentity claimsIdentity)     at Microsoft.Office.Excel.Server.MossHost.MossHostFileLoader.CheckForPermissions(IClaimsIdentity claimsIdentity)     at Microsoft.Office.Excel.Server.MossHost.MossHostHelperMethods.<>c__DisplayClass4.<TryExecuteWithUserContext>b__2()     at Microsoft.Office.Excel.Server.MossHost.MossHostHelperMethods.WithEnsureClaimsIdentitySetOnThread(IClaimsIdentity claimsIdentity, MethodToRun action)     at Microsoft.Office.Excel.Server.MossHost.MossHostHelperMethods.TryExecuteWithUserContext(IIdentity userIdentity, Action`1 method)     at Microsoft.Office.Excel.Server.MossHost.MossHostFileLoader.Init(Uri uri, Guid requestSiteId, IIdentity currentIdentity, IExcelServerDocumentContext documentContext, FileLoaderHostInfo& outFileLoaderHostInfo)     at Microsoft.Office.Excel.Server.CalculationServer.SharePointFileLoader.Init(Uri uri, Guid requestSiteId, IExcelServerDocumentContext documentContext).'. [Session: 1.V26.300230xuwA55AXFcxYzF9DfjtW90.5.en-US5.en-US73.+0360#0000-11-00-01T02:00:00:0000#+0000#0000-03-00-02T02:00:00:0000#-006036.c200d73f-5e02-4473-a541-e787b465e2291.N

Solution

1. On the server(s) running Excel services for the farm, open IIS manager and expand SharePoint Web Services.

2. Click on Content View at the bottom of the middle pane and click through the list of GUIDs until you find the one that contains ExcelService.asmx.

3. Right click on the GUID for Excel and choose Manage Application | Advanced Settings.  Note the GUID for the application pool.  This is the app pool for Excel services.

4. In IIS manager click on application pools and find the one with the GUID you noted in step 3 above.

5. Right click on the Excel services app pool and recycle it.

6. Right click on the Excel services app pool again and choose Advanced Settings.

7. Under the Recycling section | Specific Times, add a time during off hours for the app pool to automatically recycle.

After going thru the solution with my customer the error was gone completely and the service was restored.  It seems that due not recycling the Application Pool for the Excel Service Application we never got the memory cleaned up.