import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.*;
String filePath = "/path/to/excel/file.xlsx";
Workbook workbook = new XSSFWorkbook(new FileInputStream(filePath));
Sheet sheet = workbook.getSheetAt(0);
for (Row row : sheet) {
for (Cell cell : row) {
String cellValue = cell.getStringCellValue();
System.out.println("Cell Value: " + cellValue);
}
}
workbook.close();
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.*;
String filePath = "/path/to/excel/file.xlsx";
Workbook workbook = new XSSFWorkbook();
Sheet sheet = workbook.createSheet("Sheet1");
Row row = sheet.createRow(0);
Cell cell = row.createCell(0);
cell.setCellValue("Hello, World!");
FileOutputStream fileOutputStream = new FileOutputStream(filePath);
workbook.write(fileOutputStream);
fileOutputStream.close();
workbook.close();