Working with Excel : Automation API

Working with Excel

Class library usage, coding and language questions.

Working with Excel

Postby jainaakash » Fri Jun 25, 2010 2:28 pm

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
jainaakash
 
Posts: 48
Joined: Thu Jun 10, 2010 1:06 pm

Re: Working with Excel

Postby Support Team » Fri Jun 25, 2010 2:32 pm

Hi,

Please read the following blog
http://www.ranorex.com/blog/data-driven ... with-excel

Regards,
Peter
Ranorex Support Team
User avatar
Support Team
Site Admin
 
Posts: 4845
Joined: Fri Jul 07, 2006 5:30 pm
Location: Graz, Austria

Re: Working with Excel

Postby jainaakash » Fri Jun 25, 2010 3:31 pm

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
jainaakash
 
Posts: 48
Joined: Thu Jun 10, 2010 1:06 pm

Re: Working with Excel

Postby sdaly » Mon Jun 28, 2010 1:47 pm

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!
User avatar
sdaly
 
Posts: 213
Joined: Mon May 10, 2010 12:04 pm
Location: Dundee, Scotland


Return to Automation API

Who is online

Users browsing this forum: No registered users and 0 guests