How to read Excel file & save data in array...........

hello,

I opened the excel file by using workbook.open() method...
Now i want to read the data from the excel file.. & save it into
array.

help out .. how to do this.
Then i want to pass that array through SetSourceData() method & want to draw cunztomized chart...

(I am using Excel 2007, C# 2005, COM)

Thx... :)

Comments

  • Hi,

    you can read the data in the excel as follows:

    Excel.Workbook wb = Excel.Workbooks.Open(...);
    Excel.Worksheet sh = (Excel.Worksheet) wb.Sheets(1);
    Excel.Range rng = sh.get_Range("A1","A1");

    Then the value in the range can be accessed using

    rng.Value2.ToString();

    Values from multiple cells can be read by looping.


    : hello,
    :
    : I opened the excel file by using workbook.open() method...
    : Now i want to read the data from the excel file.. & save it into
    : array.
    :
    : help out .. how to do this.
    : Then i want to pass that array through SetSourceData() method & want
    : to draw cunztomized chart...
    :
    : (I am using Excel 2007, C# 2005, COM)
    :
    : Thx... :)
    :
    :

    with regards,
    vmmlog
  • Easiest and fastest way to work with Excel files in C# is to use some 3rd party component. Try using GemBox [link=http://www.gemboxsoftware.com/GBSpreadsheet.htm]Excel component for .NET[/link] which is free for use and/or testing if you have smaller files (limit is 150 rows).

    Here is a list of reasons why it's [link=http://www.gemboxsoftware.com/Excel-Automation.htm]better to use GemBox component then Excel Automation or Excel Interop[/link].

    Filip
    GemBox.Spreadsheet - [link=http://www.gemboxsoftware.com/]easiest way to read and write Excel files in .NET[/link]
  • hrm - ten bucks says filip works for GemBox
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories