Read data from Excel sheet using java
import java.io.FileInputStream;
import org.apache.poi.xssf.usermodel.
import org.apache.poi.xssf.usermodel.
import org.apache.poi.xssf.usermodel.
class Main {
public static void main(String[] args) {
// ReadFile
FileInputStream file = new FileInputStream(YOUR_FILEPATH);
@SuppressWarnings("resource")
XSSFWorkbook wb = new XSSFWorkbook(file);
XSSFSheet sheet = wb.getSheet(YOUR_SHEETNAME);
int rowcount = sheet.getLastRowNum();
ArrayList ExpectedStatus = new ArrayList();
//col no of sheet
int ColNo = Integer.valueOf(col);
System.out.println("Col:" + ColNo + " " + rowcount);
for (int i = 1; i <= rowcount; i++) {
XSSFRow celldata = sheet.getRow(i);
String value = celldata.getCell(ColNo).
System.out.println(value);
ExpectedStatus.add(value);
}
}
Comments
Post a Comment