Code to read the excel with the Interop component.

Posted by Nishithraj under C# category on | Views : 1725
We can read the excel range values through the following code.

 System.Array values = (System.Array)range.Cells.Value2;

Comments or Responses

Posted by: Raja on: 1/14/2010 Level:Starter | Status: [Member]
What is "range" man, from where this came?

Can you submit complete code snippet instead of submitting a line code of a function without its head and tails?

Thank you in advance.
Posted by: Nishithraj on: 1/14/2010 Level:Bronze | Status: [Member]

It would be always better to keep some respects while communicating through these kind of public websites.

Try to avoid the colloquel languages like "man". That makes you WEIRD .

And for your information. "We dont have to post the entire code to this website and make others confused". I think you don't have the experience in working with excel components. It's very clear by your question.

The people who worked with excel component can easily understands What is the range over there. They can have the difficulty to retrieve the data of excel through the component. That's the reason I have posted that code only.

For your satisfaction I explain what is a range.

range = sheet.get_Range("D21", "Q" + nRows.ToString());

Here the range is a object of excel component. We can select any range of columns or rows through this.

Next You can reply with a question what is sheet here.(As you require the head & tails)

Sheet is a another object to access the sheets in a work book.

Login to post response