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. Maven项目 Spring 单元测试

    使用maven创建web工程,将Spring配置文件applicationContext.xml放在src/resource下,用eclipse编译时提示class path resource [ap ...

  2. ios中的银联支付

    场景 随着移动互联网的迅猛发展,移动互联已经深深地融入我们的生活.其中,支付方式也是我们生活中经常遇到的情况.所以,在我们的应用中加入支付功能是多么的重要.现在主流的支付接口,一是支付宝类的,一是银联 ...

  3. DICOM医学图像处理:DCMTK在VS2012中的配置

    背景: 近期因为项目须要,将原本的开发IDE环境由VS2008升级到了VS2012.本以为编译完毕后的DCMTK开源库能够直接从VS2008移植到VS2012.可是通过项目属性加入完包括文件夹和依赖库 ...

  4. iframe跨域通信方案

    概述 JavaScript出于安全方面的考虑,不允许跨域调用其他页面的对象.但在安全限制的同时也给注入iframe或是ajax应用上带来了不少麻烦.这里把涉及到跨域的一些问题简单地整理一下: 首先什么 ...

  5. Windows Server 2012 R2 服务器管理器介绍和配置使用

    1. 服务管理器是用于管理系统服务的管理工具.一般常用于windows系统,使用这个工具你可以启动.停止服务:设置服务是自动.手动启动或禁用:查看某个服务的相关信息:设置服务以什么用户启动等等(一般包 ...

  6. UICollectionView在Swift3.0中的用法

    UICollectionView在Swift3.0中的用法 UICollectionView的初始化跟OC中是相似的,创建 GameView 集成自 UICollectionView .注意不同于UI ...

  7. ios sdk的制作

    制作sdk的主要目的是将自己的code通过接口提供给其他应用使用.接下来介绍.a 静态库的制作注意事项: 1.首先.a文件的静态库要进行随时的测试,因此需要将其放入应用中(创建一个应用,再创建一个.a ...

  8. jira使用

    JIRA的生产者把JIRA定义为Professional Issue Tracker,即它是一个专业的问题跟踪管理的软件.这里的"问题"对应的英文单词是Issue,所以含义比较广, ...

  9. Session累计用户数据列表

    OrderForm.html <body>  <center>  <h1 ><font size="20">Order Items& ...

  10. UVa12563(DP)

    题意:求在给定时间内,最多能唱多少歌曲,在最多歌曲的情况下,使唱的时间最长. 该题类似于01背包问题,可用01背包问题的解题思路来求,每个歌曲相当于物品,歌曲的长度相等于物品重量,每个歌曲的“价值”为 ...