Hi
you can access excel sheet in vb.net easily ,to this you need add a lib to your project,using Microsoft.Office.Interop.Excel;
code:
Private bodynitsApplicationClass As ApplicationClass = Nothing
Private worksheetdetail As Microsoft.Office.Interop.Excel.Worksheet = Nothing
Public Sub ProcessExcell(ByVal filename As String, ByVal sheetno As String)
If bodynitsApplicationClass Is Nothing Then
bodynitsApplicationClass = New ApplicationClass()
End If
If Not System.IO.File.Exists(filename) Then
UpdateControl("Source file does not exist inside " & filename)
Exit Sub
End If
Try
' System.Data.DataTable extracteDataTAble = GetAllDataFromExcel(filename);
Dim workbooks As Microsoft.Office.Interop.Excel.Workbook = bodynitsApplicationClass.Workbooks.Open(filename, 0, True, 5, "", "", _
False, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, vbTab, False, False, 0, _
True, 1, 0)
Dim sheets As Microsoft.Office.Interop.Excel.Sheets = workbooks.Worksheets
TGSDTSysLogger.Log("Opening excel sheet...", LogForObjects.Adidas, LogInforType.Detail)
' get header sheet to read
worksheetdetail = DirectCast(sheets.get_Item(Integer.Parse(sheetno)), Microsoft.Office.Interop.Excel.Worksheet)
' reade very cell based on your needs
Dim RLDZ As String = DirectCast(sheet.Cells(rowindex, 22), Microsoft.Office.Interop.Excel.Range).Value2.ToString().TrimEnd()
Catch ex As Exception
Throw ex
End Try
End Sub
thank you