The function setSheetname() in the BoundSheetRecord class does not have check on length of sheetname, it throws java.lang.IllegalArgumentException if sheet name is more than 31. Test case:- BoundSheetRecord record = new BoundSheetRecord("12345678902234567890323456789011"); Someone has tried to fix the bug for the function setSheetname() in the XSSFWorkbook class but we can do the same for the BoundSheetRecord class. like:- if(sheetname.length() > 31) { sheetname = sheetname.substring(0, 31); } Just put the above code before calling the validateSheetName(sheetName) in the setSheetname() function of the BoundSheetRecord class.