Well
My excel sheet data is like this
username password
harsha1 password1
harsha2 password2
I want to be able to select only
harsha1 password1
harsha2 password2
GOAL
I want to ignore the first line in my excel sheet which is
username password and just print the rest of the lines
with my code its printing all the lines starting from username password
code below --------------
package Rough;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import Utilities.Base_class;
public class ExcelPackage extends Base_class {
@Test(dataProvider = "harsha")
public void testa(String username, String pass )
{
System.out.println(username+pass);
}
@DataProvider(name ="harsha")
public Object[][] getdata()
{
//Xls_Reader(System.getProperty("user.dir")+""//src");
Xls_Reader xls = new Xls_Reader("C://Workspace3//Parks_Victoria//src//Data//TestSuiteData.xlsx");
int noofrow = xls.getRowCount("TestData");
int noofrows = noofrow+1;
System.out.println(noofrow);
int Columncount = xls.getColumnCount("TestData");
System.out.println(Columncount);
Object data[][] = new Object[noofrows][Columncount];
int dataRow =0;
for(int x = 0; x <noofrows;x++)
{
for (int y =0; y<Columncount;y++)
{
data[dataRow][y]= xls.getCellData("TestData", y, x);
//System.out.print(xls.getCellData("regtest", y, x));
//System.out.print("-------------------------------");
}
//System.out.println();
dataRow++;
}
return data ;
}
}
use this, tell me if works.
[quote:1bp9p0pr]for(int [color=#FF0000:1bp9p0pr]x = 1[/color:1bp9p0pr]; x <noofrows;x++)
{
for (int y =0; y<Columncount;y++)
{
data[dataRow][y]= xls.getCellData("TestData", y, x);
//System.out.print(xls.getCellData("regtest", y, x));
//System.out.print("-------------------------------");
}
//System.out.println();
dataRow++;
}
return data ;
}
}[/quote:1bp9p0pr]