Is it able to both Import and Export data's through Excel. If Soo then how to import data to excel?
Is their any inbuilt method for import excel in Ranorex 3.3 as like export?
Regards
Vinoth
Is it able to both Import and Export data's through Excel?
Re: Is it able to both Import and Export data's through Excel?
On method is to have a look at the Excel Framework I shared that uses Excel Interop to interact with Excel from C#.
http://www.ranorex.com/forum/my-excel-f ... t3265.html
http://www.ranorex.com/forum/my-excel-f ... t3265.html
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Is it able to both Import and Export data's through Excel?
Thank you for your reply.
But my requirement is to read and update the excel. I tried it with oledb connection and it is working fine in Visual Studio but unable to read the cell value from excel in Ranorex 3.3. Please find my code below
But my requirement is to read and update the excel. I tried it with oledb connection and it is working fine in Visual Studio but unable to read the cell value from excel in Ranorex 3.3. Please find my code below
using System; using System.Collections; using System.Configuration; using System.Data; using System.Data.OleDb; using System.Data.SqlClient; using System.Linq; using System.Xml.Linq; using System.Text; using System.IO; namespace ConsoleApplication6 { class Program { static void Main(string[] args) { arun a = new arun(); a.readexcel("password"); shankar s = new shankar(); s.insertexcel("password", "news"); } class arun { public void readexcel(string strcolumn) { string strcolumnname = null; try { OleDbConnection oconn = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='E:\\new.xls';Extended Properties=Excel 8.0;"); OleDbCommand ocmd = new OleDbCommand("select * from [Sheet1$]", oconn); oconn.Open(); OleDbDataReader odr = ocmd.ExecuteReader(); while (odr.Read()) { strcolumnname = valid(odr, strcolumn); if (strcolumnname != "") { break; } } oconn.Close(); } catch (Exception ex) { } } protected string valid(OleDbDataReader myreader, string colnmae) { object val = myreader[colnmae]; if (val != DBNull.Value) return val.ToString(); else // return Convert.ToString(0); return val.ToString(); } } class shankar { public void insertexcel(string strcol,string strvalue) { string strcolumnname = null; try { OleDbConnection oconn = new OleDbConnection("provider=Microsoft.Jet.OLEDB.4.0;Data Source='E:\\new.xls';Extended Properties=Excel 8.0;"); // OleDbCommand ocmd = new OleDbCommand("INSERT INTO [Sheet1$] ("+strcol+"[0]) VALUES('"+strvalue+"');", oconn); //OleDbCommand ocmd = new OleDbCommand("UPDATE [Sheet1$] set fname ='boos'", oconn); OleDbCommand ocmd = new OleDbCommand("UPDATE [Sheet1$] set "+strcol+" ='"+strvalue+"'", oconn); oconn.Open(); OleDbDataReader odr = ocmd.ExecuteReader(); //DataSet ds = new DataSet(); //OleDbDataAdapter da = new OleDbDataAdapter(); //DataTable dt = new DataTable(); //dt.TableName = "Sheet1"; //da.SelectCommand = ocmd; //da.Fill(dt); //ds.Tables.Add(dt); oconn.Close(); } catch (Exception ex) { } } } } }
Re: Is it able to both Import and Export data's through Excel?
The excel framework I shared will do that...
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Is it able to both Import and Export data's through Excel?
Can you post example of use of this framework?Ciege wrote:The excel framework I shared will do that...
Ian Fraser
Re: Is it able to both Import and Export data's through Excel?
The code is pretty well documented. Open it up, give it a look. It describes what you need to pass to each method and what is returned...
For example:
To Open Excel:
To Open a Workbook:
To read a named range:
To close Excel:
For example:
To Open Excel:
Code: Select all
Microsoft.Office.Interop.Excel.Application objXL = RFWExcel.OpenExcel();
Code: Select all
Microsoft.Office.Interop.Excel.Workbook objXLWorkBook = RFWExcel.OpenExcelWorkbook(objXL, strExcelFileName);
Code: Select all
string[] MyData = null;
string strNamedRange = "MyNamedRange";
string strExcelSpreadsheet = "MySpreadsheet.xls";
MyData = RFWExcel.ExcelReadNamedRange(objXL, objXLWorkBook, strExcelFileName, strNamedRange, strSheet);
Code: Select all
objXL.Quit();
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Is it able to both Import and Export data's through Excel?
I created a basic excel based framework demo for the QTP community some years ago. That demo was a running example based on the QTP tutorial flight app. What may seem obvious to the writer of code may not be obvious to others.
A file reading and writing to Excel is not a framework.
A file reading and writing to Excel is not a framework.
Ian Fraser
Re: Is it able to both Import and Export data's through Excel?
Thank you for your professional opinion on this... I will hold it most high regards with the other drivel I read on the internet...IanF wrote:A file reading and writing to Excel is not a framework.
If you would have a look at the framework that I shared, you (being of such high intelligence) should notice that there are several methods developed to access the Microsoft Excel Interop with Ranorex. This is designed to allow the Ranorex community to easily access Excel spreadsheets right from their code with full error checking and Ranorex reporting... In other words, it is a framework of methods for Ranorex users to interact with Excel.
So before passing judgment I think maybe you should understand what it is you are judging... By your definition .NET would not be a framework either I suppose...</rant off>
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!
Ciege...
Ciege...
Re: Is it able to both Import and Export data's through Excel?
No need to be unpleasant.
Just saying if you are putting a demo out there and you are calling it a solution then make it a solution not a single file.
I am new to Ranorex and single file with no context to it is of little help.
Just saying if you are putting a demo out there and you are calling it a solution then make it a solution not a single file.
I am new to Ranorex and single file with no context to it is of little help.
Ian Fraser
- Support Team
- Site Admin
- Posts: 12145
- Joined: Fri Jul 07, 2006 4:30 pm
- Location: Houston, Texas, USA
- Contact:
Re: Is it able to both Import and Export data's through Excel?
Hey guys, no need to argue on naming
It might be just one file, but it is quite a large one with a lot of documentation in it. And Ciege provided some sample code, too.
Call it framework, module, library, utility methods, or whatever -- the main point is that the functionality helps other Ranorex users.
Regards,
Alex
Ranorex Team

It might be just one file, but it is quite a large one with a lot of documentation in it. And Ciege provided some sample code, too.
Call it framework, module, library, utility methods, or whatever -- the main point is that the functionality helps other Ranorex users.
Regards,
Alex
Ranorex Team
Re: Is it able to both Import and Export data's through Excel?
The attached file was originally written around 2002 for the Rational Robot automation tool. I converted it to VBScript for QTP in 2005. It became the data handler for a basic QTP Keyword Data driven framework.
By its self it is not a framework. I did use this file to create a framework concept demo that was shared with the QTP community:
http://www.sqaforums.com/showflat.php?C ... PHPSESSID=
This demo was an unpack and run demo with all the script assets needed. A good number of other frameworks were developed of that methodology.
So you can understand my comfusion when a single file is presented as an (Automation) Framework.
By its self it is not a framework. I did use this file to create a framework concept demo that was shared with the QTP community:
http://www.sqaforums.com/showflat.php?C ... PHPSESSID=
This demo was an unpack and run demo with all the script assets needed. A good number of other frameworks were developed of that methodology.
So you can understand my comfusion when a single file is presented as an (Automation) Framework.
You do not have the required permissions to view the files attached to this post.
Ian Fraser