Page 1 of 1

Creating and writing values to an Excel Sheet

Posted: Thu Apr 16, 2015 3:53 pm
by Noumaan
Hi,

I know that this topic has been brought up a few times in forum posts. Posting this again I am sorry, but I was not able to find the answer for what I wanted to achieve.

The other forum posts gave examples of frameworks and methods that could be used. But for my purposes that is probably overkill.

All I want to do is create an Excel spreadsheet and write values to a cell.

Can anyone give step by step instructions with code examples to help me. I've also looked at generic C# forums for this but am struggling to apply to Ranorex. I've been looking at this for 2 days and am still struggling to even create an Excel spreadsheet

ANy help or pointers would be very much appreciated.

Kind Regards

Noumaan

Re: Creating and writing values to an Excel Sheet

Posted: Fri Apr 17, 2015 12:45 pm
by odklizec
Hi,

You can use the code mentioned here (to write values to existing excel file):
http://www.ranorex.com/forum/desperatel ... tml#p16024

What's not mentioned in this post is that you need to add Microsoft.Office.Interop.Excel to References...
ExcelReference.png

Re: Creating and writing values to an Excel Sheet

Posted: Fri Apr 17, 2015 1:21 pm
by CookieMonster
Hi,

Caution: It depends against which version of Excel your are working with. With 2003 / 2007 it's ok, but if you are using 2010 / 2013, then you have to add a few more references. Otherwise you won't be able to access all the features, or methods. It also depends against which .Net Version.
And if you need help iterating trough lines and cell and writing into it, please let me know.

Regards
Dan

Re: Creating and writing values to an Excel Sheet

Posted: Fri Apr 24, 2015 6:30 pm
by Support Team
Hi,

I just want to add that it is also possible by using the Ranorex Office plugin, so there would not be a need to use the Interop DLLs. A basic and quite old explanation can be found here: Excel Test Automation Plug-In for Ranorex.
For questions, please do let us know.

Regards,
Markus