<?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>devexp &#187; excel</title>
	<atom:link href="http://www.devexp.eu/tag/excel/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devexp.eu</link>
	<description>DEVelopment EXPerience, shared with the world!</description>
	<lastBuildDate>Fri, 28 Oct 2011 12:07:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Read from Excel in ASP</title>
		<link>http://www.devexp.eu/2009/10/14/read-from-excel-in-asp/</link>
		<comments>http://www.devexp.eu/2009/10/14/read-from-excel-in-asp/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 10:14:28 +0000</pubDate>
		<dc:creator>van Rumste Kenneth</dc:creator>
				<category><![CDATA[ASP]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[read]]></category>
		<category><![CDATA[vb]]></category>

		<guid isPermaLink="false">http://www.devexp.eu/?p=998</guid>
		<description><![CDATA[I always had a hard time finding correct documentation on the old ASP (active server pages) language and I needed it one more time in the last few days to create a script that read from an excel file. As &#8230; <a href="http://www.devexp.eu/2009/10/14/read-from-excel-in-asp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>I always had a hard time finding correct documentation on the old ASP (active server pages) language and I needed it one more time in the last few days to create a script that read from an excel file.</p>
<p>As I believe that it might be handy for a handful of people around the world (is there actually anybody else still developing in ASP these days?), I hereby share my little piece of code with you guys.</p>
<p>Any suggestions or comments are always welcome.</p>
<p>In my example we read from an excel file that has 1 small table that has 1000 lines and columns from A until G.<br />
The first row contains all the column names.</p>
<pre class="brush: vb; title: ; notranslate">
'initialize variables
Dim objConn, strSQL
Dim x

Set objConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
objConn.Open &quot;DRIVER={Microsoft Excel Driver (*.xls)}; IMEX=1; HDR=NO; &quot;&amp;_
 &quot;Excel 8.0; DBQ=&quot; &amp; Server.MapPath(&quot;filename.xls&quot;) &amp; &quot;; &quot;
strSQL = &quot;SELECT * FROM A1:G1000&quot;

Response.Write(&quot;&lt;table border=&quot;&quot;1&quot;&quot;&gt;&quot;)
Response.Write(&quot;&lt;tr&gt;&quot;)
'write all columnNames
For x=0 To objRS.Fields.Count-1
 Response.Write(&quot;&lt;th&gt;&quot; &amp; objRS.Fields(x).Name &amp; &quot;&lt;/th&gt;&quot;)
Next
Response.Write(&quot;&lt;/tr&gt;&quot;)

Do Until objRS.EOF

' write as much columns as there are in your excel file
Response.Write(&quot;&lt;td&gt;&quot; &amp; objRS.Fields(0).Value &amp; &quot;&lt;/td&gt;&quot;)
Response.Write(&quot;&lt;td&gt;&quot; &amp; objRS.Fields(1).Value &amp; &quot;&lt;/td&gt;&quot;)
Response.Write(&quot;&lt;td&gt;&quot; &amp; objRS.Fields(2).Value &amp; &quot;&lt;/td&gt;&quot;)
Response.Write(&quot;&lt;td&gt;&quot; &amp; objRS.Fields(3).Value &amp; &quot;&lt;/td&gt;&quot;)
Response.Write(&quot;&lt;td&gt;&quot; &amp; objRS.Fields(4).Value &amp; &quot;&lt;/td&gt;&quot;)
Response.Write(&quot;&lt;td&gt;&quot; &amp; objRS.Fields(5).Value &amp; &quot;&lt;/td&gt;&quot;)
Response.Write(&quot;&lt;td&gt;&quot; &amp; objRS.Fields(6).Value &amp; &quot;&lt;/td&gt;&quot;)

objRS.Close

Response.Write(&quot;&lt;/table&gt;&quot;)

Set objRS=Nothing
</pre>
<div class="shr-publisher-998"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://www.devexp.eu/2009/10/14/read-from-excel-in-asp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

