I am beginner to Apache POI api. I am trying to create excel sheet using arraylist.
My java code is as follows.
HSSFWorkbook wb = new HSSFWorkbook();
You just need to move the call to
sheet.autoSizeColumn(5);
to a point in your code after the data has been added, so right after your while loop should work.