I am trying to write data into Excel sheet using a for loop. But it only writes on first cell and don't iterate further. I tried a lot but couldn't fix this bug. What is wrong with my cod e. Please help. Here is what i have done so far
HSSFRow row1 = sheet.createRow((short) 1);
String[] cellname = new String[]{"A", "B", "C", "D", "E", "F", "G", "H", "I"};
String[] fields = new String[]{"Student's Name", "Father's Name", "Mother's Name", "Address", "Phone No", "Date Of Birth", "Roll NO", "Class", "subjectMajor"};
for (int i = 0; i <= 9; i++) {
String Cellname = cellname[i] + 2;
System.out.print(Cellname);
HSSFCell CellName = row1.createCell((short) i);
CellName.setCellValue(fields[i]);
wb.write(output);
output.close();
}