Search code examples
javaspringapache-poifilereaderfast-excel

Read File Excel


I read a big file excel with 70,000 rows and 10 columns with JAVA. I use Apache POI to read and get the data but it takes much time like 1 hour. I changed to using fast-excel to read the file but just can read 2,000 row.

Can someone suggest to me how to tunning the Apache poi? Or maybe have other solutions?


Solution

  • org.ttzero:eec:0.5.12 supports reading millions of rows of Excel github links, Unfortunately, only Chinese documents are available

    try (ExcelReader reader = ExcelReader.read(Paths.get("./abc.xlsx"))) {
        // Print
        reader.sheet(0).rows().forEach(System.out::println);
    
        // Convert to Java Bean
        List<Item> list =  reader.sheet(0)
            .header(1)  // <- Specify the title line number
            .rows()
            .map(row -> row.to(Item.class)) // <- Convert to Java Bean
            .collect(Collectors.toList());
    }