import org.apache.poi.ss.usermodel.*;
public class ExcelReader {
public static void main(String[] args) {
try {
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");
}
}
System.out.println();
}
e.printStackTrace();
}
}
}
import org.apache.poi.ss.usermodel.*;
import java.io.FileOutputStream;
import java.io.IOException;
public class ExcelWriter {
public static void main(String[] args) {
cell1.setCellValue("Hello");
cell2.setCellValue("World");
try (FileOutputStream fileOut = new FileOutputStream("output.xlsx")) {
}
} catch (IOException e) {
e.printStackTrace();
}
}
}