企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
![](https://img.kancloud.cn/3b/ef/3befa76ae26a96ffc6716394e20f18a2_1473x178.jpg) ```java @Test public void read02() { String path = this.getClass().getResource("/read/003.xlsx").getPath(); //写法1:使用实体类接收 List<Human> dataList01 = EasyExcel.read(path).head(Human.class).sheet().doReadSync(); for (Human data : dataList01) { log.info("{}", data); } //Human(name=张三, age=25, gender=男, total=175) //Human(name=李四, age=28, gender=男, total=179) //Human(name=王五, age=35, gender=男, total=180) //写法2:使用Map接收 List<Map<Integer, Object>> dataList02 = EasyExcel.read(path).sheet().doReadSync(); for (Map<Integer, Object> data : dataList02) { log.info("{}", data); } //{0=张三, 1=25, 2=男, 3=175} //{0=李四, 1=28, 2=男, 3=179} //{0=王五, 1=35, 2=男, 3=180} } ```