Creating and writing values to an Excel Sheet

Ask general questions here.
Noumaan
Posts: 2
Joined: Thu Feb 26, 2015 1:21 pm

Creating and writing values to an Excel Sheet

Post by Noumaan » Thu Apr 16, 2015 3:53 pm

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

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7469
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Creating and writing values to an Excel Sheet

Post by odklizec » Fri Apr 17, 2015 12:45 pm

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
You do not have the required permissions to view the files attached to this post.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

CookieMonster
Certified Professional
Certified Professional
Posts: 74
Joined: Mon Aug 14, 2006 7:17 pm
Location: CH

Re: Creating and writing values to an Excel Sheet

Post by CookieMonster » Fri Apr 17, 2015 1:21 pm

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
You do not have the required permissions to view the files attached to this post.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Creating and writing values to an Excel Sheet

Post by Support Team » Fri Apr 24, 2015 6:30 pm

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