I want to importer an Excel spreadsheet. Is there a library that can help me with this?
EDIT: Specifically, I'm using Visual Studio 2010 and Visual Basic, so I need a library that fits these requirements and can import Excel spreadsheets.
How do I importer excel using VB2010?
Â
You can try writing a simple class in VB.NET as below.
Public Class ExcelImporter
   Public Sub Import()
Â
       Dim ExcelConnection  As System.Data.OleDb.OleDbConnection
       Dim dtExcel As System.Data.DataSet
       Dim ExcelCommand As System.Data.OleDb.OleDbDataAdapter
       ExcelConnection  = New System.Data.OleDb.OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:ExcelFileName.xls';Extended Properties=Excel 8.0;")
       ExcelCommand = New System.Data.OleDb.OleDbDataAdapter("select * from [Sheet1$]", ExcelConnection )
       ExcelCommand.TableMappings.Add("Table", "ExcelSheet")
       dtExcel = New System.Data.DataSet
       ExcelCommand.Fill(dtExcel)
       ExcelConnection.Close()
       Return dtExcel;
Â
   End Sub
End Class
Â
What the code does is it finds a excel file stored in a physical location on your computer and retrieve the data in specified excel sheet in to a dataset and then returns the dataset. Now you are able to perform any operation using the dataset returned by the method.