Note that there are some explanatory texts on larger screens.

plurals
  1. PORead data from Excel files
    primarykey
    data
    text
    <p>I'm having some trouble reading from an Excel spreadsheet in C#. I have this code which I read every cell from A to X.</p> <pre><code>System.Array myvalues; string[] strArray; Microsoft.Office.Interop.Excel.Range range = worksheet.get_Range("A" + i.ToString(), "W" + i.ToString()); while(range.Count!=0) { i++; //Console.WriteLine(i); range = worksheet.get_Range("A" + i.ToString(), "W" + i.ToString()); myvalues = (System.Array)range.Cells.Value; strArray = ConvertToStringArray(myvalues); name = clearstr(strArray[1]); for ( int j = 1 ; j &lt;= Int32.Parse(number_add_file)*4 ; j++) { name = ""; lang_add = ""; price = ""; description = ""; Console.WriteLine("I got in!"); Microsoft.Office.Interop.Excel.Range range_add = worksheet.get_Range("X" + i.ToString(),Type.Missing); System.Array values = (System.Array)range_add.Cells.Value; string[] str = ConvertToStringArray(values); name = str[0]; lang_add = str[1]; price = str[2]; description = str[3]; Console.WriteLine(name + " " + lang_add + " " + price + " " + description); addfile(); } </code></pre> <p>My question is: How could i read next 4 * "number" rows in excel based on "number" value ?</p> <p>For example:</p> <pre><code> A B C D E F G H I J a a a a a 1 a a a a </code></pre> <p>F's cell value is 1 so I would like to read ( G H I J) If F's cell value is 2 the I would like to read ( G H I J K L M N)</p> <pre><code> A B C D E F G H I J K L M N a a a a a 2 a a a a a a a a </code></pre> <p>F's cell value 3 :</p> <pre><code> A B C D E F G H I J K L M N O P Q R a a a a a 3 a a a a a a a a a a a a </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload