i want to read 2 excel sheets and display it in new sheet using java
<p>i have two sheets.in one sheet i have emp id and empname. in my second sheet sheet i will have empid and mobile. i should get my output in 3rd sheet which should have empid ,empname and mobile. a person may have more than 1 mobile no.in this case it should be seprated using semicolon .now  i have read excel files and stored in arraylist using poi. now how to pass this arraylist as an object to constructor. and how to get the desired output. this is the code for reading and storing in array. what to do next</p>

<pre><code>import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class ExcelReadExample {

    @SuppressWarnings("unchecked")
    public static void main(String[] args) throws Exception {
        //
        // An excel file name. You can create a file name with a full 
        // path information.
        //
        String filename = "C:\\Users\\gopi\\Documents\\details.xls";

        //
        // Create an ArrayList to store the data read from excel sheet.
        //
        List sheetData = new ArrayList();

        FileInputStream fis = null;
        try {
            //
            // Create a FileInputStream that will be use to read the 
            // excel file.
            //
            fis = new FileInputStream(filename);
            POIFSFileSystem myFileSystem = new POIFSFileSystem(fis);

            //
            // Create an excel workbook from the file system.
            //
            HSSFWorkbook workbook = new HSSFWorkbook(myFileSystem);
            //
            // Get the first sheet on the workbook.
            //
            for(int i=0;i&lt;2;i++){
            HSSFSheet sheet = workbook.getSheetAt(i);

            //
            // When we have a sheet object in hand we can iterator on 
            // each sheet's rows and on each row's cells. We store the 
            // data read on an ArrayList so that we can printed the 
            // content of the excel to the console.
            //
            Iterator rows = sheet.rowIterator();
            while (rows.hasNext()) {
                HSSFRow row = (HSSFRow) rows.next();
                Iterator cells = row.cellIterator();

                List data = new ArrayList();
                while (cells.hasNext()) {
                    HSSFCell cell = (HSSFCell) cells.next();
                    data.add(cell);
                }

                sheetData.add(data);
            }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (fis != null) {
                fis.close();
            }
        }


    }


}
</code></pre>

<p>thanks in advance
gopi</p>
