0

I have a sheet name "Test (testing)". I can access this sheet just fine when I use a xlsx workbook but when the workbook is in the xls format I get the following error:

System.Data.OleDb.OleDbException (0x80040E37): The Microsoft Jet database engine could not find the object ''Test [testing]$'_'.  Make sure the object exists and that you spell its name and the path name correctly.
   at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(OleDbHResult hr)
   at System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS dbParams, Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior behavior, Object& executeResult)
   at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior behavior, String method)
   at System.Data.OleDb.OleDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.OleDb.OleDbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
   at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)

The error seems to be looking for "Testing [testing]". Is Jet doing some conversion I don't know about? Is there any other reason for this error? Note the workbooks are exactly the same, just the file format is different.

pnuts
  • 58,317
  • 11
  • 87
  • 139
Justin808
  • 20,859
  • 46
  • 160
  • 265

1 Answers1

0

I had to filter out tables ending in $_ and $'_ for it to work.

This post lead me to the fix. $'_ isn't listed in the post but was causing the issue as well as $_.

Justin808
  • 20,859
  • 46
  • 160
  • 265