<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Matt J. Wilson &#187; IMEX</title>
	<atom:link href="http://www.mattjwilson.com/blog/tag/imex/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mattjwilson.com/blog</link>
	<description>General ramblings, programming frustrations, and complete randomness.  Have questions? E-mail me.</description>
	<lastBuildDate>Tue, 19 Jan 2010 19:37:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Microsoft Excel Drivers and IMEX</title>
		<link>http://www.mattjwilson.com/blog/2009/02/13/microsoft-excel-drivers-and-imex/</link>
		<comments>http://www.mattjwilson.com/blog/2009/02/13/microsoft-excel-drivers-and-imex/#comments</comments>
		<pubDate>Fri, 13 Feb 2009 20:15:09 +0000</pubDate>
		<dc:creator>Matt J. Wilson</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[IMEX]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[VBA]]></category>

		<guid isPermaLink="false">http://www.mattjwilson.com/blog/?p=6</guid>
		<description><![CDATA[For any developers that are ever forced to develop in VBA, such as myself, I take pity on you for having to deal with some of Microsoft&#8217;s idiotic software kinks.  My latest gripe?  The use of any built-in driver to query an Excel sheet.
Here&#8217;s an example of my sheet:
   NumberOne
1  123456
2  987654
3  135791
4  246802
5  503513
6  [...]]]></description>
			<content:encoded><![CDATA[<p>For any developers that are ever forced to develop in VBA, such as myself, I take pity on you for having to deal with some of Microsoft&#8217;s idiotic software kinks.  My latest gripe?  The use of any built-in driver to query an Excel sheet.</p>
<p>Here&#8217;s an example of my sheet:</p>
<p><code><strong>   NumberOne</strong><br />
1  123456<br />
2  987654<br />
3  135791<br />
4  246802<br />
5  503513<br />
6  546516<br />
7  889846<br />
8  984658<br />
9  Some Text Here</code></p>
<p>I tried multiple data source connections, such as these two:</p>
<pre class="brush: vb;">dbConnectionString = &quot;DRIVER={Microsoft Excel Driver (*.xls)};Readonly=1;DBQ=&quot; &amp; SourceFile
dbConnectionString = &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; &amp; SourceFile &amp; &quot;;Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'&quot;</pre>
<p>So the data I read in for my NumberOne column should be the following values: <code>123456, 987654, 135791, 246802, 503513, 546516, 889846, 984658, Some Text Here</code>.</p>
<p>What do these <em>actually </em>produce: <code>123456, 987654, 135791, 246802, 503513, 546516, 889846, 984658, <strong>null</strong>.</code></p>
<p>Now why would a null result be produced? I specifically stated to use the IMEX parameter, but it is simply not enough to overcome the stupidity of Microsoft.  Any built-in Excel driver will query the first 8 rows of a sheet and then make a determination (without your permission or knowledge) as to what type of column it is, thereby ignoring anything that doesn&#8217;t meet this data type later in the sheet.  There are no exceptions, no warnings, and no way around it but to insert a &#8220;MICROSOFT_IS_STUPID&#8221; cell in one of these rows, that you then must explicitly ignore, to force the driver to stop it&#8217;s ridiculous assumptions and read <strong>all</strong> of your data.  Also, please note that having a header row won&#8217;t rectify the problem, you must have some intermixed data types in the first 8 rows of <em>data</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mattjwilson.com/blog/2009/02/13/microsoft-excel-drivers-and-imex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

