0

I have seen plenty of similar questions but none of the solutions work for me.

I am trying to load a .xlsx file with 8 columns and 3 rows. There is just numbers in the cells and nothing else in the file. It's taking over 10 seconds to load this file. Any idea why?

        File file1 = new File("C:\\Projects\\SafeSiteLive\\web\\images\\safesite_documents\\1\\sampleData2.xlsx");
        double time = System.currentTimeMillis();

        XSSFWorkbook workbook = new XSSFWorkbook(file1);
        double endTimme = System.currentTimeMillis();
        System.out.println("Time took to parse excel file: " + (endTimme - time));

The time outputted here is around 15 seconds. Surely that's too long? In the end I want to be loading files with 1000 rows but at the moment this takes way too long.

Time output "Time took to parse excel file: 15039.0"

Any suggestions?

OneTwo
  • 2,291
  • 6
  • 33
  • 55
  • 1
    1.Depends on the hardware 2. Can you print the time? (maybe its millsec instead of sec) Consider this answer http://stackoverflow.com/questions/22051802/slow-xssfworkbook-and-workbookfactory-when-reading-xlsx-files – user1933888 May 13 '15 at 10:50
  • Here is the time "Time took to parse excel file: 15039.0" I just created the excel file and entered the data in, there is not other data or anomalies in the file. – OneTwo May 13 '15 at 10:54
  • 1
    version of POI you are using? Its mostly not an API problem, but rather a hardware issue, try using a profiler – user1933888 May 13 '15 at 10:59
  • But don't you need a XSSFWorkbook to construct an SXSSFWorkbook? – OneTwo May 13 '15 at 10:59
  • 1
    Have you tried to convert your Excel (XLSX) to (old) XLS? Maybe this can help you in any way... – Ben May 13 '15 at 11:01
  • Did you try following the instructions in the [Apache POI FAQ on memory and performance](http://poi.apache.org/faq.html#faq-N10109)? – Gagravarr May 14 '15 at 08:15

0 Answers0