Closed Thread
Results 1 to 3 of 3

Thread: C# using excel

  1. #1
    Siten0308's Avatar
    Siten0308 is offline Programming Professional
    Join Date
    Jun 2008
    Location
    California, USA
    Posts
    302
    Rep Power
    16

    Question C# using excel

    Hello,

    I am sooo trying to find using namespace Excel; i found Microsoft.office.interlop.Excel, but cant find excel, because i want to use objects: Workbook from Excel.workbook and also i want to use ExcelObj but cant find it, anyone has any ideas where this is and where to download it?

    Thanks
    Its only funny till someone gets hurt.... THEN ITS HILARIOUS

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    housefull is offline Newbie
    Join Date
    Jan 2010
    Posts
    1
    Rep Power
    0

    Re: C# using excel

    Great work .. really informative .. and thanks a lot for sharing ..

  4. #3
    Siten0308's Avatar
    Siten0308 is offline Programming Professional
    Join Date
    Jun 2008
    Location
    California, USA
    Posts
    302
    Rep Power
    16

    Re: C# using excel

    Sorry about that, i had been meaning to update, so i gave up on Excel thing, and used Oledb to pull the data from an excel file as an example below:

    Code:
    ReadExcel()
    {
    // Test.xls is in the C:\
    string connectionString = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=C:\\Test.xls;";
    connectionString += "Extended Properties=Excel 8.0;";
    OleDbConnection con = new OleDbConnection(connectionString);
    // always read from the sheet1.
    OleDbDataAdapter da = new OleDbDataAdapter("Select * from [Sheet2$A1:A5];", con);
    OleDbDataAdapter da1 = new OleDbDataAdapter("Select * from [Sheet2$B1:B5];", con);
    DataTable dt = new DataTable();
    DataTable dt1 = new DataTable();
    da.Fill(dt);
    da1.Fill(dt1);
    }
    which works fine, but you must convert datarow to a list or something to get it into a listbox etc. just an FYI, but i think you can do it from datarow to listbox, not sure but anyways, hope this helps.
    Its only funny till someone gets hurt.... THEN ITS HILARIOUS

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Excel 2007 and excel 2010
    By secondrate in forum Visual Basic Programming
    Replies: 1
    Last Post: 06-16-2010, 04:49 AM
  2. add to an excel sheet
    By lordwittie in forum Visual Basic Programming
    Replies: 5
    Last Post: 04-05-2010, 04:18 AM
  3. Import form Excel, filtr, export to excel
    By seatcordobawrc in forum Pascal and Delphi
    Replies: 1
    Last Post: 03-30-2010, 02:30 PM
  4. Fun with Excel
    By Xystus777 in forum C# Programming
    Replies: 0
    Last Post: 12-04-2008, 07:07 AM
  5. using VB with excel
    By renoald in forum Visual Basic Programming
    Replies: 26
    Last Post: 10-20-2008, 09:52 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts