Page 1 of 1
Working with Excel
Posted: Fri Jun 25, 2010 1:28 pm
by jainaakash
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
Re: Working with Excel
Posted: Fri Jun 25, 2010 1:32 pm
by Support Team
Hi,
Please read the following blog
http://www.ranorex.com/blog/data-driven ... with-excel
Regards,
Peter
Ranorex Support Team
Re: Working with Excel
Posted: Fri Jun 25, 2010 2:31 pm
by jainaakash
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
Re: Working with Excel
Posted: Mon Jun 28, 2010 12:47 pm
by sdaly
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!