Hi,
How to read excel column headers in ranorex user code?
With below code am able to read data but not headers:
Ranorex.Core.Data.ExcelDataConnector excelConnector = new Ranorex.Core.Data.ExcelDataConnector("excelConnector",sTestData + ExcelFileName + ".xlsx","Sheet1","A:A",System.Windows.Forms.CheckState.Unchecked);
Ranorex.Core.Data.ColumnCollection columnCollection;
Ranorex.Core.Data.col
Ranorex.Core.Data.RowCollection rowCollection;
excelConnector.LoadData(out columnCollection, out rowCollection);
Read excel
- RobinHood42
- Posts: 324
- Joined: Fri Jan 09, 2015 3:24 pm
Re: Read excel
Hi,
It's not a good idea to access or even modify data using the Ranorex Excel data connector. I would highly recommend using the official Microsoft.Office.Interop to do so: Example: https://coderwall.com/p/app3ya/read-excel-file-in-c
Cheers,
Robin
It's not a good idea to access or even modify data using the Ranorex Excel data connector. I would highly recommend using the official Microsoft.Office.Interop to do so: Example: https://coderwall.com/p/app3ya/read-excel-file-in-c
Cheers,
Robin
-
- Posts: 2
- Joined: Wed Aug 04, 2021 9:26 am
Re: Read excel
1.Install Nuget Package of IronXL into your project.
2.Now you can access all excel operations like create, load, read e.t.c through IronXL in various formats like XLSX, XLS, CSV and TSV .
3.Follow the link: https://ironsoftware.com/csharp/excel/t ... le-csharp/
2.Now you can access all excel operations like create, load, read e.t.c through IronXL in various formats like XLSX, XLS, CSV and TSV .
3.Follow the link: https://ironsoftware.com/csharp/excel/t ... le-csharp/
Code: Select all
WorkBook workbook = WorkBook.Load("test.xlsx");
WorkSheet sheet = workbook.WorkSheets.First();
//Select cells easily in Excel notation and return the calculated value
int cellValue = sheet["A2"].IntValue;
// Read from Ranges of cells elegantly.
foreach (var cell in sheet["A2:A10"])
{
Console.WriteLine("Cell {0} has value '{1}'", cell.AddressString, cell.Text);
}
-
- Posts: 2
- Joined: Wed Aug 04, 2021 9:26 am
Re: Read excel
1.Install Nuget Package of IronXL into your project.
2.Now you can access all excel operations like create, load, read e.t.c through IronXL in various formats like XLSX, XLS, CSV and TSV .
3.Follow the link: Excel in C# tutorial
2.Now you can access all excel operations like create, load, read e.t.c through IronXL in various formats like XLSX, XLS, CSV and TSV .
3.Follow the link: Excel in C# tutorial
Code: Select all
WorkBook workbook = WorkBook.Load("test.xlsx");
WorkSheet sheet = workbook.WorkSheets.First();
//Select cells easily in Excel notation and return the calculated value
int cellValue = sheet["A2"].IntValue;
// Read from Ranges of cells elegantly.
foreach (var cell in sheet["A2:A10"])
{
Console.WriteLine("Cell {0} has value '{1}'", cell.AddressString, cell.Text);
}