Reputation: 21
Basically guys in vb.net I need to open an excel document and read the value of a certain cell(A1 for example) be it text or numerical and store it as a string value to use elsewhere in my code.
Thanks in advance.
Upvotes: 1
Views: 2128
Reputation: 7449
You can use Excel Interop as in this example here. Or you can use Open XML SDK as in this example here. For XLSX file you can also develop a custom solution, xlsx are nothing but zipped folder of XML files, this might be helpfull.
Upvotes: 0
Reputation: 5665
Try
'start Excel app
Dim App1 As Microsoft.Office.Interop.Excel.Application
App1 = CreateObject("Excel.Application")
' load excel document
exApp.Workbooks.Open(fname)
Dim Sheet1 As Microsoft.Office.Interop.Excel.Worksheet
Sheet1 = exApp.Workbooks(1).Worksheets(1)
a = Sheet1.Range("A1").Value.ToString
Upvotes: 1