import org.apache.poi.ss.usermodel.*;
public class ExcelReader {
public static void main(String[] args) throws Exception {
String filePath = "path/to/excel.xlsx";
Workbook workbook = WorkbookFactory.create(new File(filePath));
Sheet sheet = workbook.getSheetAt(0);
for (Row row : sheet) {
for (Cell cell : row) {
CellType cellType = cell.getCellType();
if (cellType == CellType.STRING) {
System.out.print(cell.getStringCellValue() + "\t");
} else if (cellType == CellType.NUMERIC) {
System.out.print(cell.getNumericCellValue() + "\t");
} else if (cellType == CellType.BOOLEAN) {
System.out.print(cell.getBooleanCellValue() + "\t");
} else if (cellType == CellType.BLANK) {
System.out.print("\t");
}
}
System.out.println();
}
workbook.close();
}
}