VB.NET – Excel files importing tutorial

VB.NET Excel files importing tutorial shows how to read from Excel files (XLS, XLSX) with Visual Basic .NET using Spreadsheet SDK. Use the source code sample below to import data from Excel files.


 ' Create new Spreadsheet SDK object in VB
       Dim document As New Spreadsheet()
       document.LoadFromFile("MyExcelFile.xls") ' you may open xlsx Excel files too

       ' Get the worksheet named "Sheet1" from excel file
       Dim worksheet As Worksheet = document.Workbook.Worksheets.ByName("Sheet1")

       ' Now we can read cells from this worksheet. We will read A1 cell value 
       Console.WriteLine("Cell A1 value: {0}", worksheet.Cell("A1").Value)
       document = nothing