@Test
    public void simpleRead() {
        // Approach 1: JDK8+, no need to create a separate DemoDataListener
        // since: 3.0.0-beta1
        String fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx";
        // Specify the class to read the data, then read the first sheet. The file stream will be automatically closed.
        // By default, it reads 100 rows at a time. You can process the data directly.
        // The number of rows to read can be set in the constructor of `PageReadListener`.
        EasyExcel.read(fileName, DemoData.class, new PageReadListener<DemoData>(dataList -> {
            for (DemoData demoData : dataList) {
                log.info("Reading a row of data: {}", JSON.toJSONString(demoData));
            }
        })).numRows(2).sheet().doRead();

        // Approach 2:
        // Anonymous inner class, no need to create a separate DemoDataListener
        fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx";
        // Specify the class to read the data, then read the first sheet. The file stream will be automatically closed.
        EasyExcel.read(fileName, DemoData.class, new ReadListener<DemoData>() {
            /**
             * Batch size for caching data
             */
            public static final int BATCH_COUNT = 100;
            /**
             * Temporary storage
             */
            private List<DemoData> cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);

            @Override
            public void invoke(DemoData data, AnalysisContext context) {
                cachedDataList.add(data);
                if (cachedDataList.size() >= BATCH_COUNT) {
                    saveData();
                    // Clear the list after saving
                    cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
                }
            }

            @Override
            public void doAfterAllAnalysed(AnalysisContext context) {
                saveData();
            }

            /**
             * Simulate saving data to the database
             */
            private void saveData() {
                log.info("Saving {} rows of data to the database!", cachedDataList.size());
                log.info("Data saved successfully!");
            }
        }).sheet().doRead();

        // Important note: DemoDataListener should not be managed by Spring. It needs to be instantiated every time you read an Excel file.
        // Approach 3:
        fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx";
        // Specify the class to read the data, then read the first sheet. The file stream will be automatically closed.
        EasyExcel.read(fileName, DemoData.class, new DemoDataListener()).sheet().doRead();

        // Approach 4
        fileName = TestFileUtil.getPath() + "demo" + File.separator + "demo.xlsx";
        // One reader per file
        try (ExcelReader excelReader = EasyExcel.read(fileName, DemoData.class, new DemoDataListener()).build()) {
            // Build a sheet. You can specify the name or index.
            ReadSheet readSheet = EasyExcel.readSheet(0).build();
            readSheet.setNumRows(2);
            // Read a single sheet
            excelReader.read(readSheet);
        }
    }
Simplest way to read
<p>
1. Create an entity class corresponding to the Excel data structure. Refer to {@link DemoData}.
<p>
2. Since EasyExcel reads Excel files row by row, you need to create a callback listener for each row. Refer to {@link DemoDataListener}.
<p>
3. Directly read the file.
fastexcel-test/src/test/java/cn/idev/excel/test/demo/read/ReadTest.java