"External table is not in the expected format"http://forums.asp.net/t/1793303.aspx/1?+External+table+is+not+in+the+expected+format+Thu, 19 Apr 2012 05:30:36 -040017933034934410http://forums.asp.net/p/1793303/4934410.aspx/1?+External+table+is+not+in+the+expected+format+"External table is not in the expected format" <p>Hii..</p> <p>I am retrieving data from excel using following connection string:</p> <p>static string datasource = &quot;C:\\Drive\\Training_Template.xlsx&quot;;<br> OleDbConnection DBConnection = new OleDbConnection(@&quot;PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=&quot; &#43; datasource &#43; &quot;;Extended Properties='Excel 12.0 Xml'&quot;);</p> <p>Its working perfectly fine when i am using VS 2010 server but its giving error</p> <p><strong>&quot;External table is not in the expected format&quot;</strong></p> <p>when I am hosting it on IIS 7.5.</p> <p>I am using excel 2010.</p> <p>please suggest me some solution to deal with this error..</p> <p>Thanks..</p> <p></p> 2012-04-16T10:23:53-04:004935032http://forums.asp.net/p/1793303/4935032.aspx/1?Re+External+table+is+not+in+the+expected+format+Re: "External table is not in the expected format" <p>Hi, are you sure that u are uploading a '.xlsx' file and that it haven't password ? :-)</p> <p>This is the connection that I'm using and it works:</p> <pre class="prettyprint">@&quot;provider=Microsoft.ACE.OLEDB.12.0;data source=&quot; &#43; pathExcel &#43; &quot;;Extended Properties='Excel 12.0 Xml;HDR=YES;'&quot;</pre> <p><br> <br> </p> 2012-04-16T15:30:20-04:004936271http://forums.asp.net/p/1793303/4936271.aspx/1?Re+External+table+is+not+in+the+expected+format+Re: "External table is not in the expected format" <p>Hii alejandro.lagos&nbsp;</p> <p>Thanks for reply:)</p> <p>I am not getting the same error now. This time &nbsp;I used the below mentioned connection string</p> <p>&nbsp; &nbsp; <em>&nbsp; OleDbConnection DBConnection = new OleDbConnection(@&quot;PROVIDER=Microsoft.ACE.OLEDB.12.0;DATA SOURCE=&quot; &#43; datasource &#43; &quot;;Extended Properties='Excel 12.0 Xml;HDR=YES;IMEX=1'&quot;);</em></p> <p>But now I am getting a new error</p> <p><em>Microsoft Excel cannot access the file 'C:\trng\abc.xslx'. There are several possible reasons:</em></p> <p><em> The file name or path does not exist.</em><br> <em> The file is being used by another program.</em><br> <em> The workbook you are trying to save has the same name as a currently open workbook.</em></p> <p><em><br> </em>for this I have killed &quot;EXCEL.EXE&quot; file from task manager but still it gives above mentioned error.</p> <p>I seriously dont know what to do:(</p> 2012-04-17T09:15:14-04:004937554http://forums.asp.net/p/1793303/4937554.aspx/1?Re+External+table+is+not+in+the+expected+format+Re: "External table is not in the expected format" <p></p> <blockquote><span class="icon-blockquote"></span> <h4>mannnn</h4> <p></p> <p>Its working perfectly fine when i am using VS 2010 server but its giving error</p> <p><strong>&quot;External table is not in the expected format&quot;</strong></p> <p>when I am hosting it on IIS 7.5.</p> <p></p> </blockquote> <p></p> <p>Are you sure that your issue happens when you deploy the file onto IIS7.5 and the problem happensAnd everything goes well when using the file on your local machineIf yesI guess there's something wrong your deployment of the file or something related to that</p> 2012-04-18T01:46:48-04:004937705http://forums.asp.net/p/1793303/4937705.aspx/1?Re+External+table+is+not+in+the+expected+format+Re: "External table is not in the expected format" <p>Hii..</p> <p>To ensure that there is no problem in hosting, I hosted another application in same way and it worked perfectly...</p> <p></p> 2012-04-18T04:51:46-04:004937733http://forums.asp.net/p/1793303/4937733.aspx/1?Re+External+table+is+not+in+the+expected+format+Re: "External table is not in the expected format" <p></p> <blockquote><span class="icon-blockquote"></span> <h4>mannnn</h4> Extended Properties='Excel 12.0 Xml'</blockquote> <p></p> <p>Try to remove &quot;Xml&quot; and have a try:-)</p> 2012-04-18T05:12:28-04:004937734http://forums.asp.net/p/1793303/4937734.aspx/1?Re+External+table+is+not+in+the+expected+format+Re: "External table is not in the expected format" <p></p> <blockquote><span class="icon-blockquote"></span> <h4>mannnn</h4> Extended Properties='Excel 12.0 Xml'</blockquote> <p></p> <p>Try to remove &quot;Xml&quot; and have a try:-)</p> 2012-04-18T05:12:28-04:004939976http://forums.asp.net/p/1793303/4939976.aspx/1?Re+External+table+is+not+in+the+expected+format+Re: "External table is not in the expected format" <p>Hi Decker Dong-MSFT&nbsp;</p> <p>I have tried all these things...</p> 2012-04-19T04:01:40-04:004940005http://forums.asp.net/p/1793303/4940005.aspx/1?Re+External+table+is+not+in+the+expected+format+Re: "External table is not in the expected format" <p></p> <blockquote><span class="icon-blockquote"></span> <h4>mannnn</h4> <p></p> <p>Hi Decker Dong-MSFT&nbsp;</p> <p>I have tried all these things...</p> <p></p> </blockquote> <p></p> <p>Still the same errorOr error is changed</p> <p>And is your excel file valid</p> 2012-04-19T04:33:44-04:004940075http://forums.asp.net/p/1793303/4940075.aspx/1?Re+External+table+is+not+in+the+expected+format+Re: "External table is not in the expected format" <p>yup same error..</p> 2012-04-19T05:17:51-04:004940093http://forums.asp.net/p/1793303/4940093.aspx/1?Re+External+table+is+not+in+the+expected+format+Re: "External table is not in the expected format" <p></p> <blockquote><span class="icon-blockquote"></span> <h4>mannnn</h4> <p></p> <p>yup same error..</p> <p></p> </blockquote> <p></p> <p>This seems to be a little strangeWell, let's try another way</p> <p>1<span>File - &gt; Save As - Microsoft Excel 97-Excel 2003 &amp;5.0/95 workbook(*.xls)</span></p> <p><span>2Then do this</span></p> <pre class="prettyprint">string strConn = &quot;Provider=Microsoft.Jet.OLEDB.4.0;&quot; &#43; &quot;Data Source=C:\\Drive\\Training_Template.xls;Extended Properties=&quot;&quot;Excel 8.0;HDR=YES;IMEX=1&quot;&quot;&quot; OleDbConnection DBConnection = new OleDbConnection(strConn);</pre> <p></p> 2012-04-19T05:30:36-04:00