We have a CRM add-on for Importing Price Lists into CRM. For this tool, we expect the details to be provided in an Excel sheet. The tool reads the excel workbook provided and imports the prices.

Once we had an issue with one of our customers complaining of the data successfully being imported, yet an error message is displayed 'Sheet1$'_ not found. What was intriguing was the error could only be replicated with the sheet that are customer had provided us. If we were to create a new Excel workbook and provide it for import, we would receive no errors :( It was a classic example of "it works on my machine...")

After researching into this issue further, we found the reason.

The tool used the following line of code to read all sheets from the workbook

dtTables = objExcelConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);

This returned 2 data tables, one with the name 'Sheet1$' and the other named 'Sheet1$'_.

the first sheet 'Sheet1$' is the normal naming convention when you read an excel workbook. But where did the second sheet 'Sheet1$'_ come from?? If you open the excel workbook, you will find only one sheet in the workbook named 'Sheet1'.

The second sheet 'Sheet1$'_ is a hidden sheet that Excel creates each time you filter the records on a sheet. It will create a hidden copy of the sheet. This is the sheet that the program tries to read through the code.

To fix this problem we added the following code to catch such sheets
if(SheetName.EndsWith("_"))
{
do nothing;
}
else
{
do operation
}

 
 
https://community.dynamics.com/crm/b/crminogic/archive/2009/06/29/reading-excel-workbooks-using-getoledbschematable-returns-a-sheet-with-suffix.aspx

Microsoft Jet 数据库引擎找不到对象'Sheet1$_'。请确定对象是否存在,并正确地写出它的名称和路径的更多相关文章

  1. C# 解决读取dbf文件,提示Microsoft Jet 数据库引擎找不到对象的问题

    前言 最新项目需要经常和dbf文件打交道,在实际场景中很多软件需要和一些老的系统进行数据交互,而这些系统都在使用foxpro数据库,读取dbf文件一般都是分为两种情况:第一:安装foxpro的驱动进行 ...

  2. C# - Excel - Microsoft Access 数据库引擎找不到对象

    我几乎要无语了,疯掉了,以为是office本身的问题,换了好多次office2007,安装又不顺利,换到了office2010,想想大部分应该兼容2007,所以用着office2010了. 甚至差点要 ...

  3. Microsoft Jet 数据库引擎打不开文件,它已经被别的用户以独占方式打开,或没有查看数据的权限。

    System.Data.OleDb.OleDbException (0x80004005): Microsoft Jet 数据库引擎打不开文件'D:\wwwroot\gonghouxie\wwwroo ...

  4. Microsoft Jet 数据库引擎 SQL 和 ANSI SQL 的比较

    http://westlife063.blog.163.com/blog/static/129942096201052591210384/   Microsoft Jet 数据库引擎 SQL 和 AN ...

  5. Err.number错误号和可捕获的 Microsoft access 数据库引擎和 DAO错误说明

    错误码        信息2420        数字语法错误2421        日期语法错误2422        字符串语法错误2423        ‘.’.‘!’.或 ‘()’的使用无效2 ...

  6. IIS发布网站Microsoft JET Database Engine 错误 '80004005'的解决办法,基于Access数据库

    在网站发布后,访问网站会有80004005的错误提示. 项目环境 项目基于Access数据库,server2012,文件系统为NTFS格式. 错误信息 Microsoft JETDatabase En ...

  7. sqlserver安装出现找不到数据库引擎错误

    sqlserver安装出现找不到数据库引擎错误 问题的解决 第一次安装SQL server,发现它较于Oracle,都有安装卸载十分麻烦的特点.刚开始安装,就让我频繁遇到这个“找不到数据库引擎”的错误 ...

  8. Microsoft.Jet.OLEDB.4.0和Microsoft.ACE.OLEDB.12.0的区别

    Microsoft.Jet.OLEDB.4.0和Microsoft.ACE.OLEDB.12.0的区别 时间 2012-12-19 20:30:12  CSDN博客原文  http://blog.cs ...

  9. c# 程序调试出现“未在本地计算机上注册“Microsoft.Jet.OLEDB.4.0”提供程序。”

    简单的程序代码如下:DataSet ds=new DataSet();try{ string strCon = @"Provider=Microsoft.Jet.OLEDB.4.0;Data ...

随机推荐

  1. 《Java4Android视频教程》学习笔记(三)

    一:抽象类 接口 1.使用abstract修饰抽象类 抽象函数 2.一个类中有一个或者多个抽象函数,必须定义为抽象类 3.抽象类可以不含有抽象函数 4.抽象类不可以生成对象 tip:如果一个代码在语意 ...

  2. Evernote Clearly :: Firefox 附加组件

    Evernote Clearly :: Firefox 附加组件 Evernote Clearly 10.1.1.2 作者: Evernote Evernote Clearly 可使博客贴文.文章和网 ...

  3. 第八届河南省赛F.Distribution(水题)

    10411: F.Distribution Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 11  Solved: 8 [Submit][Status] ...

  4. CSS3学习----选择器、字体

     属性选择器: [att*=val]{}若att元素属性值包括val指定字符,则使用该样式 [att^=val]{}若att元素属性值开头字符为val,则使用该样式 [att&=val]{ ...

  5. android程序启动画面之Splash总结[转]

    方法一: 很多应用都会有一个启动界面.欢迎画面慢慢隐现,然后慢慢消隐.实现这种效果的方法有两种(暂时只发现两种)1.使用两个Activity,程序启动时候load第一张Activity,然后由tick ...

  6. Windows 10 安装

    下载了 Windows 10 的 ISO 文件:WindowsTechnicalPreview-x64-ZH-CN.iso,在 VMWare 10 上进行了安装. 安装时没有 Windows 10   ...

  7. docker基础入门之一

    一.概述 1.传统虚拟化技术: 纯软件的虚拟化是通过对于硬件层的模拟从而实现允许运行多个操作系统: 硬件辅助虚拟化需要硬件层面对于虚拟化的支持,类似Intel-VT技术等,具有更高的运行效率: 解决方 ...

  8. 用jersey + spring 实现rest服务及单元测试

    jersey提供了强大的rest功能,可以通过简洁的标注和编码实现业务的需求,架构会透明的把你的pojo对象转化为客户端可以接受的json/xml文件模式,当然也可以用它做一些基于ajax的表单提交和 ...

  9. iOS中的地图和定位

    文章摘自http://www.cnblogs.com/kenshincui/p/4125570.html#location  如有侵权,请联系删除. 概览 现在很多社交.电商.团购应用都引入了地图和定 ...

  10. JavaWEB HTTP请求中POST与GET的区别

    From 的get 和post方法.在数据传输过程中分别对应了HTTP协议中的GET和POST方法. 二者主要区别: GET从服务其获取数据;POST上传数据. GET将表单中的数据按照variabl ...