Output data into DataSource

Ask general questions here.
Posts: 29
Joined: Thu Nov 08, 2018 2:22 am

Output data into DataSource

Post by praneet » Tue Nov 13, 2018 7:46 am

Hello Team,

We are using Ranorex licence Version v8.3.0 and we are trying to generate output data into input datasource with new column.
We are able to genreate output reports in different formats like Emailing, PDF reporting through Ranorex automation helpers, in the same way do we have any plugins/ functions to generate output data(Example Pass/ Fail) into our input excel/Data table.

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

Re: Output data into DataSource

Post by odklizec » Tue Nov 13, 2018 9:22 am


I'm afraid, there is no a built-in way to write to excel data connector. But it's possible to write to excel, using .net methods or 3rd party libs. And then you just need to refresh the data connector. I would suggest to start with this post:

Also, it's way easier to write to CSV data connector, because this can be done directly with Ranorex own dataconnector methods. I posted a small example here:
how-to-dynamically-create-test-containe ... tml#p49222
Honestly, from the long-term perspective, it's much better to use CSV over Excel, which only advantage is the ability to organize data in multiple tabs and maybe using Excel macros? But that's about it. Excel data connectors makes the opening and editing of data connectors slower, excel files cannot be edited directly in Ranorex, and excel files cannot be easily compared in source control management apps. And of course, they still require Excel to be installed on the machine, where you create your tests. Ture, excel is almost everywhere today, but still, it's an unnecessary obstacle ;)
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

Posts: 29
Joined: Thu Nov 08, 2018 2:22 am

Re: Output data into DataSource

Post by praneet » Tue Feb 26, 2019 12:02 pm

Finally I got solution to place output report on attached Datasource Excel using microsoft excel interop ddl
var TC = TestSuite.CurrentTestContainer;
//int rowId = TC.DataContext.Source.Rows.Count;
int rowId = TC.DataContext.CurrentRowIndex;
int colid=1;

Excel.Application excelDataconnectorSourceFile = new Excel.ApplicationClass();
excelDataconnectorSourceFile.Visible = true;
string workbookPath = System.IO.Directory.GetCurrentDirectory() + "\\DataSourceExcelFile.xlsx";
Excel.Workbook excelWorkbook = excelDataconnectorSourceFile.Workbooks.Open(workbookPath);
Excel.Sheets excelSheets = excelWorkbook.Worksheets;
string currentSheet = "Sheet1";
Excel.Worksheet excelWorksheet = (Excel.Worksheet)excelSheets.get_Item(currentSheet);

excelDataconnectorSourceFile.Cells[rowId+1,colid] = "PASS/FAIL REPORTS";