How to get data from an Excel sheet?

If you're looking how to pick username and passwords or any data from an excel sheet then below steps will help you out:


1) Download J-Excel jar (What is J-Excel), you can get the path to download J-Excel jar by clicking here
2) Now, add this jar to your build path. You can look for the steps.
3) Create a new class and add below code:
public class Excel {
static Sheet s ;
 public static void main(String[] args) throws BiffException, IOException {

FileInputStream fis = new FileInputStream("C:\\Users\\DELL\\Desktop\\r.xls");
Workbook w = Workbook.getWorkbook(fis);
s = w.getSheet(0);


for (int i=0; i<=s.getRows(); i++)
{
 String username = s.getCell(0, i).getContents();
 System.out.println(username);
 String username1 = s.getCell(1, i).getContents();
 System.out.println(username1);

}
}