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
Great work .. really informative .. and thanks a lot for sharing ..
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:
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.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); }
Its only funny till someone gets hurt.... THEN ITS HILARIOUS
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks