17
17
import org .apache .poi .ss .util .NumberToTextConverter ;
18
18
19
19
public class ExcelReader {
20
- public List <Map <String , String >> getData (String excelFilePath , String sheetName )
20
+ public static List <Map <String , String >> getData (String excelFilePath , String sheetName )
21
21
throws InvalidFormatException , IOException {
22
22
Sheet sheet = getSheetByName (excelFilePath , sheetName );
23
23
return readSheet (sheet );
@@ -29,7 +29,7 @@ public List<Map<String, String>> getData(String excelFilePath, int sheetNumber)
29
29
return readSheet (sheet );
30
30
}
31
31
32
- private Sheet getSheetByName (String excelFilePath , String sheetName ) throws IOException , InvalidFormatException {
32
+ private static Sheet getSheetByName (String excelFilePath , String sheetName ) throws IOException , InvalidFormatException {
33
33
Sheet sheet = getWorkBook (excelFilePath ).getSheet (sheetName );
34
34
return sheet ;
35
35
}
@@ -39,11 +39,11 @@ private Sheet getSheetByIndex(String excelFilePath, int sheetNumber) throws IOEx
39
39
return sheet ;
40
40
}
41
41
42
- private Workbook getWorkBook (String excelFilePath ) throws IOException , InvalidFormatException {
42
+ private static Workbook getWorkBook (String excelFilePath ) throws IOException , InvalidFormatException {
43
43
return WorkbookFactory .create (new File (excelFilePath ));
44
44
}
45
45
46
- private List <Map <String , String >> readSheet (Sheet sheet ) {
46
+ private static List <Map <String , String >> readSheet (Sheet sheet ) {
47
47
Row row ;
48
48
int totalRow = sheet .getPhysicalNumberOfRows ();
49
49
List <Map <String , String >> excelRows = new ArrayList <Map <String , String >>();
@@ -63,7 +63,7 @@ private List<Map<String, String>> readSheet(Sheet sheet) {
63
63
return excelRows ;
64
64
}
65
65
66
- private int getHeaderRowNumber (Sheet sheet ) {
66
+ private static int getHeaderRowNumber (Sheet sheet ) {
67
67
Row row ;
68
68
int totalRow = sheet .getLastRowNum ();
69
69
for (int currentRow = 0 ; currentRow <= totalRow + 1 ; currentRow ++) {
@@ -90,11 +90,11 @@ private int getHeaderRowNumber(Sheet sheet) {
90
90
return (-1 );
91
91
}
92
92
93
- private Row getRow (Sheet sheet , int rowNumber ) {
93
+ private static Row getRow (Sheet sheet , int rowNumber ) {
94
94
return sheet .getRow (rowNumber );
95
95
}
96
96
97
- private LinkedHashMap <String , String > getCellValue (Sheet sheet , Row row , int currentColumn ) {
97
+ private static LinkedHashMap <String , String > getCellValue (Sheet sheet , Row row , int currentColumn ) {
98
98
LinkedHashMap <String , String > columnMapdata = new LinkedHashMap <String , String >();
99
99
Cell cell ;
100
100
if (row == null ) {
0 commit comments