Hi Team,
Could you please provide me a sample code for reading from and writing to excel using VB.NET.
I would like to take input from a spreadsheet into a variable and then use it in the script.
Thanks for your help.
Regards,
Aakash
Working with Excel
- Support Team
- Site Admin
- Posts: 12167
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Graz, Austria
Re: Working with Excel
Hi,
Please read the following blog
http://www.ranorex.com/blog/data-driven ... with-excel
Regards,
Peter
Ranorex Support Team
Please read the following blog
http://www.ranorex.com/blog/data-driven ... with-excel
Regards,
Peter
Ranorex Support Team
-
- Posts: 48
- Joined: Thu Jun 10, 2010 12:06 pm
Re: Working with Excel
Hi Peter,
Thanks for your quick response. I went through the blog link you mentioned but was not able to understand & get it working. Could you please provide a bit more detailed explaination with steps to be followed and get me a sample code in VB.NET.
To be simple, I have created one spreadsheet with two columns, 'FirstName' & 'LastName'. Now, I want to get the values for both the columns and display in a pop-up msgbox. I am not sure how to Create an Excel Application Object and Open the File to read the values from it.
Apologies for being annoying.
Thanks and Regards,
Aakash
Thanks for your quick response. I went through the blog link you mentioned but was not able to understand & get it working. Could you please provide a bit more detailed explaination with steps to be followed and get me a sample code in VB.NET.
To be simple, I have created one spreadsheet with two columns, 'FirstName' & 'LastName'. Now, I want to get the values for both the columns and display in a pop-up msgbox. I am not sure how to Create an Excel Application Object and Open the File to read the values from it.
Apologies for being annoying.
Thanks and Regards,
Aakash
Re: Working with Excel
I use this as below....
Add the CSVConnector.vb file to your project
Then use like this -
Dim testData as New CSVConnector("AddEditDeleteTestData.csv")
For Each row As DataRow In testData.Rows
msgbox(row("FirstName").ToString())
msgbox(row("LastName").ToString())
Next
testData = Nothing
Hope this helps!
Add the CSVConnector.vb file to your project
Then use like this -
Dim testData as New CSVConnector("AddEditDeleteTestData.csv")
For Each row As DataRow In testData.Rows
msgbox(row("FirstName").ToString())
msgbox(row("LastName").ToString())
Next
testData = Nothing
Hope this helps!