java - Generating files by reading excel sheet -


there excel file having lot of file names in 1 of column . need write java code should read file names , generate same in destination.can 1 me ?

import java.io.file; import java.io.fileinputstream; import java.io.filenotfoundexception; import java.io.fileoutputstream; import java.io.ioexception; import java.util.iterator;  import org.apache.poi.hssf.usermodel.hssfsheet; import org.apache.poi.hssf.usermodel.hssfworkbook; import org.apache.poi.ss.usermodel.cell; import org.apache.poi.ss.usermodel.row; import org.apache.poi.ss.usermodel.sheet; import org.apache.poi.ss.usermodel.workbook; import org.apache.poi.xssf.usermodel.xssfsheet; import org.apache.poi.xssf.usermodel.xssfworkbook;  public class test {      public static void main(string[] args) throws ioexception {          try {              fileinputstream file = new fileinputstream(new file("c:\\test.xls"));              hssfworkbook workbook = new hssfworkbook(file);             hssfsheet sheet = workbook.getsheetat(0);           //iterate through each rows first sheet             iterator<row> rowiterator = sheet.iterator();             while(rowiterator.hasnext()) {                 row row = rowiterator.next();                  //for each row, iterate through each columns                 iterator<cell> celliterator = row.celliterator();                 while(celliterator.hasnext()) {                      cell cell = celliterator.next();                     system.out.print(cell.getstringcellvalue() + "\t\t");                     fileoutputstream outfile =new fileoutputstream(new file("c:\\"+cell.getstringcellvalue()));                     workbook.write(outfile);                 }                 system.out.println("");             }             file.close();            /*  fileoutputstream outfile =new fileoutputstream(new file("c:\\update.xls"));             workbook.write(outfile);*/             //outfile.close();          } catch (filenotfoundexception e) {             e.printstacktrace();         } catch (ioexception e) {             e.printstacktrace();         }     } } 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -