title: Writing a huge data 2D Array to excel file using java POI
body: <p>I have a 2D arrays about 16000 X 16000 and i want to export these records to excel file. currently i can export up to 1000  X1000 of that 2D array within short time. But when I increase the size the array for example 3000 X 3000 my program run for a long time without returning any data.
  I am asking for help to export the whole 2D array to an excel file and am using POI.</p>
  
  <p>My sample codes to export data where one if the parameters is my 2D array.</p>
  
  <p>public class exportData {</p>
  
  <pre><code>public static void exportDataToExcel(String fileName, String tabName, int[][] data) throws FileNotFoundException, IOException
    {
      //Create new workbook and tab
        Workbook wb = new XSSFWorkbook();
        FileOutputStream fileOut = new FileOutputStream(fileName);
        Sheet sheet = wb.createSheet(tabName);
  
        //Create 2D Cell Array
        Row[] row = new Row[data.length];
        Cell[][] cell = new Cell[row.length][];
  
        //Define and Assign Cell Data from Given
        for(int i = 0; i &lt; row.length; i ++)
        {
            row[i] = sheet.createRow(i);
            cell[i] = new Cell[data[i].length];
  
            for(int j = 0; j &lt; cell[i].length; j ++)
            {
                cell[i][j] = row[i].createCell(j);
                cell[i][j].setCellValue(data[i][j]);
            }
  
        }
  
        //Export Data
        wb.write(fileOut);
        fileOut.close();
        System.out.println("File exported successfully");
    }
  </code></pre>
  
  <p>}</p>