It is possible in general, but not quite simple, but this is a significantly difficult task.
XLS file format is processed by the HSSFWorkbook class (and corresponds to HSSFSheet , etc.).
XLSX file format is processed by the XSSFWorkbook class (and XSSFSheet , etc.).
So, to save your file as XLSX after opening and editing it using NPOI, you need to create a new XSSFWorkbook , then for each worksheet of the source file you need to create the corresponding XSSFSheet , copy the data to it from your source sheet and so on, while you donβt get a full copy of your data, and then save the book to a file.
source share