What's the best way to read an XLS/XLSX file in VB.Net. Right now the way I'm going about it is how we've done it in the past by the following.....
strConn = "Provider=Microsoft.ACE.OLEDB.12.0; Extended Properties=""Excel 12.0;HDR=No;""; Data Source=" & xlsFilePath & ";"
da = New OleDb.OleDbDataAdapter("SELECT * FROM [Page1_1$]", strConn)
da.TableMappings.Add("Table", "Excel")
da.Fill(ds)
Then I access a certain row/col by the following......
ds.Tables(0).Rows.Item(j).ItemArray(1)
Is this the best way to be doing this or should I be using the Microsoft.Office.Interop.Excel that I've been reading about? I messed with it quickly and the first thing I noticed is it actually opened the XLS file in an Excel Window. Are there reasons for using this versus what I've been using? The only real issue I've seen with how I've been doing it is if I have a cell that has over 255 characters. It has issues with that unless it's in the first X amount of rows. That isn't a big deal. Other then that we've never really had any issues. I was just asked if this was the old way of doing it and if the Microsoft.Office.Interop.Excel was what we should be moving towards.
Any thoughts/suggestions/comments would be greatly appreciated.
Thanks.