Skip to content
Advertisement

File is corrupted after creating excel (.xlsx) file by using Apache POI with Java

I have created a Workbook/Excel in .xlsx format with Java using Apache POI API successfully. My code is as below that is created a file named “RiponAlWasim.xlsx” in D drive:

JavaScript

When I tried to open “RiponAlWasim.xlsx” it was shown the file is corrupted. What’s the wrong?

Advertisement

Answer

It needs to be added at least one sheet to the workbook. So, after creating a worksheet the following code is working well:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement