Java 读取excel创建excel通过 cn.hutool.poi.excel包

Path execl1 = Paths.get("/训练数据录音流水号.xlsx");
List<Map<String, Object>> list = new ArrayList<>();
ExcelReader reader = ExcelUtil.getReader(execl1.toString());
Sheet sheet = reader.getSheets().get(0);
Iterator<Row> it = sheet.rowIterator();
it.next();
int n = 0;
while (it.hasNext() && n < 10) {
Map<String, Object> map = new HashMap<>();
Row next = it.next();
String index0 = next.getCell(0).getStringCellValue();
String index1 = next.getCell(1).getStringCellValue();
String index2 = next.getCell(2).getStringCellValue();
String index3 = next.getCell(3).getStringCellValue();
String index4 = next.getCell(4).getStringCellValue();
map.put("录音流水号", index0);
map.put("接触号", index1);
map.put("文本内容", index2);
map.put("关联标签", index3);
map.put("内容", index4);
list.add(map);
n++;
}
String tempPath = "/IdUtil.fastSimpleUUID() + ".xlsx";
File file = new File(tempPath);
BigExcelWriter writer = ExcelUtil.getBigWriter(file);
writer.write(list, true);
writer.flush();
posted @   lambertlt  阅读(124)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· 25岁的心里话
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示