import org.apache.poi.ss.usermodel.*;
public class ExcelExample {
public static void main(String[] args) {
Workbook workbook = null;
try {
workbook = WorkbookFactory.create(new File("example.xlsx"));
Sheet sheet = workbook.getSheetAt(0);
Row row = sheet.getRow(0);
Cell cell = row.getCell(0);
System.out.println(cell.getStringCellValue());
Cell newCell = row.createCell(1);
newCell.setCellValue("Hello, World!");
FileOutputStream fileOut = new FileOutputStream("example.xlsx");
workbook.write(fileOut);
fileOut.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (workbook != null) {
try {
workbook.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}