I had a similar problem recently when I started reading directly from Excel sheets too.&nbsp; The problem was that the code below creates a 3-dimensional array, not a 2-dimensional one as expected.<br><br>That is, when I looked at the contents of 'data' in irb, it looked like the following:
<br><br>data = [[[a,1,..]], [[b,2,..]], [[c,3,..]], etc]<br><br>Try adding &quot;.flatten&quot; to your retrieval line:<br>&nbsp; data &lt;&lt; worksheet.Range(&quot;a#{line}:u#{line}&quot;)['Value'].flatten<br><br>This worked for me.&nbsp; Now the 'data' array will be in an expected 2-dimensional format.&nbsp; That is, it should now look like:
<br><br>data = [[a,1.0,..], [b,2.0,..], [c,3.0,..], etc]<br>
<br>Incidentally, since this is a 2-dimensional array I don't know what you mean by 'access 3rd element'.&nbsp; If you want to print the 2nd value in the 3rd row, you might do something like:<br><br>puts data[2][1]<br>=&gt; 3.0
<br><br>Hope this helps.&nbsp; Paul.<br><br><br><div><span class="gmail_quote">On 02/08/06, <b class="gmail_sendername">VIKASH KUMAR</b> &lt;<a href="mailto:vikashkumar051@yahoo.co.in">vikashkumar051@yahoo.co.in</a>&gt; wrote:
</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div>Sir,</div>  <div>&nbsp;</div>  <div><font color="#0000ff">I am storing values from excel to a array name 'data
</font>', I am using below code for it.&nbsp;&nbsp;</div>  <div>&nbsp;</div>  <div>&nbsp;</div>  <div>excel = WIN32OLE::new('excel.Application')</div>  <div>&nbsp;workbook = excel.Workbooks.Open('E:\sam.xls')<br>&nbsp;worksheet = workbook.Worksheets(1)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br>&nbsp;worksheet.Select&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;excel['Visible'] = true<br></div>  <div>line = '2'<br><strong><font color="#0000ff">data = Array.new<br></font></strong>while worksheet.Range(&quot;a#{line}&quot;)['Value']<br>data &lt;&lt; 
worksheet.Range(&quot;a#{line}:u#{line}&quot;)['Value']<br>data.each { |x| print x,&nbsp; &quot;\n\n\n&quot;.chomp }<br>puts(&quot;\n&quot;)<br>line.succ!<br>end<br></div>  <div><strong><font color="#0000ff">Now, I wants to access 3rd element stored in the above array name 'data'.
</font></strong>&nbsp;<strong><font color="#0000ff"> I am
 facing problem in doing this.&nbsp; Please send me a solution for this.</font></strong></div>  <div>&nbsp;</div>  <div>Thanks in Advance</div></div><div><span class="sg">  <div>&nbsp;</div>  <div>Vikash Kumar</div></span></div><div><span class="ad">
<p> 
        

        
                </p><br></span></div></blockquote></div><br>