1
votes

I would like to copy/import two text files to two different excel sheets (sheet1 & Sheet2) on the same workbook, creating i cells to accommodate all lines from my text files. Is this possible? Help please.

ArrayList arr=new ArrayList();

FileOutputStream fos=new FileOutputStream("AX_OUTPUT.xls");
HSSFWorkbook workBook = new HSSFWorkbook();
HSSFSheet spreadSheet = workBook.createSheet("DATE_ON");
HSSFRow row;
HSSFCell cell;




     for(int i=0;i<arr.size();i++){
           int count = 0;
           row = spreadSheet.createRow((short) i);
           cell = row.createCell(i);
           System.out.println(arr.get(i));
           cell.setCellValue(arr.get(i).toString());
         }

           workBook.write(fos);
           arr.clear();
1

1 Answers

0
votes

should have been row.createCell(0) instead of passing i.