Creating and writing values to an Excel Sheet

Ask general questions here.
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


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


User avatar
Ranorex Guru
Ranorex Guru
Posts: 6529
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


You can use the code mentioned here (to write values to existing excel file): ... tml#p16024

What's not mentioned in this post is that you need to add Microsoft.Office.Interop.Excel to References...
ExcelReference.png (6.23 KiB) Viewed 3440 times
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

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


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.

ExcelReferences.png (4.51 KiB) Viewed 3436 times

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

Re: Creating and writing values to an Excel Sheet

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


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.