MCPcopy Create free account
hub / github.com/TestLeafInc/Simba / DataLibrary

Class DataLibrary

src/main/java/com/force/utility/DataLibrary.java:8–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import org.apache.poi.xssf.usermodel.XSSFWorkbook;
7
8public class DataLibrary {
9 public static Object[][] readExcelData(String excelfileName) {
10 XSSFWorkbook wbook;
11 Object[][] data = null ;
12 try {
13 wbook = new XSSFWorkbook("./data/"+excelfileName+".xlsx");
14 XSSFSheet sheet = wbook.getSheetAt(0);
15 int rowCount = sheet.getLastRowNum();
16 int colCount = sheet.getRow(0).getLastCellNum();
17 data = new Object[rowCount][colCount];
18 for (int i = 1; i <= rowCount; i++) {
19 for (int j = 0; j < colCount; j++) {
20 data[i-1][j] = sheet.getRow(i).getCell(j).getStringCellValue();
21 }
22 }
23 wbook.close();
24 } catch (IOException e) {
25 System.err.println(e.getMessage());
26 }
27 return data;
28 }
29}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected