Hi,
Can you please help me resolve this error?
using DataReader;
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ExcelReaderFile
{
class DummyTest
{
[Test]
public void TestA()
{
}
public object[] getData()
{
string fileName = ConfigurationManager.AppSettings["TestDataSheetPath"];
string TestCaseName = "TC3";
string sheetName = "Sheet1";
ExcelReader excel = new ExcelReader(fileName);
int testStartRow = excel.getRowNumber(sheetName, 0, TestCaseName);
int dataStartRow = testStartRow + 2;
int colStartRow = testStartRow + 1;
int row = 0;
while (!excel.getCellData(sheetName, 0, dataStartRow + row).Equals(""))
{
row++;
}
int col = 0;
while (!excel.getCellData(sheetName, col, colStartRow).Equals(""))
{
col++;
}
//Read the data
object[] data = new object[row][];
int dataRow = 0;
for (int i = dataStartRow; i < dataStartRow + row; i++)
{
data[i - dataStartRow] = new object[col];
for (int j = 0; j < col; j++)
{
data[dataRow][j] = excel.getCellData(sheetName, j, i);
}
dataRow++;
}
// Console.ReadKey();
}
}
}
Instructor
gunjan Replied on 16/07/2019
Can you please share the code.
Hi Gunjan,
I have already added my code.
Please let me know if you can not access
Thanks,
Swathi
Please close this as I have resolved the issue
Instructor
gunjan Replied on 24/07/2019
What was the issue?
In "Read the Data" section, i had to use "object[][] data = new object[row][];" instead of "object[] data = new object[row][];"