easyexcle 导出csv

导入jar

 <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>easyexcel</artifactId>
            <version>3.3.3</version>
        </dependency>
代码
 private static List<List<String>> head() {
   
        List<List<String>> list = ListUtils.newArrayList();
        List<String> head0 = ListUtils.newArrayList();
        head0.add("字符串" + System.currentTimeMillis());
        List<String> head1 = ListUtils.newArrayList();
        head1.add("数字" + System.currentTimeMillis());
        List<String> head2 = ListUtils.newArrayList();
        head2.add("日期" + System.currentTimeMillis());
        list.add(head0);
        list.add(head1);
        list.add(head2);
        return list;
    }

    private static List<List<Object>> dataList() {
   
        List<List<Object>> list = ListUtils.newArrayList();
        for (int i = 0; i < 10; i++) {
   
            List<Object> data = ListUtils.newArrayList();
            data.add("字符串" + i);
            data.add(0.56);
            data.add(new Date());
            list.add(data);
        }
        return list;
    }

    public static void main(String[] args) {
   

        String fileName = "/opt/test.csv";
        EasyExcel.write(fileName).excelType(ExcelTypeEnum.CSV).head(head()).sheet("模板").doWrite(dataList());
    }

官方

相关推荐

  1. easyexcle 导出csv

    2024-02-05 10:46:03       31 阅读
  2. SpringBoot整合easyExcel实现CSV格式文件的导入导出

    2024-02-05 10:46:03       46 阅读
  3. EasyExcel导入导出

    2024-02-05 10:46:03       30 阅读
  4. EasyExcel实现导入导出

    2024-02-05 10:46:03       10 阅读
  5. EasyExcel导入导出使用

    2024-02-05 10:46:03       33 阅读

最近更新

  1. shell脚本实现mysql 数据库备份

    2024-02-05 10:46:03       0 阅读
  2. 数据结构第11节: B树

    2024-02-05 10:46:03       0 阅读
  3. Spring Boot与RSocket的集成

    2024-02-05 10:46:03       0 阅读
  4. 责任链模式

    2024-02-05 10:46:03       0 阅读
  5. docker run/build Dockerfile 修改及完善

    2024-02-05 10:46:03       1 阅读

热门阅读

  1. Transformer的PyTorch实现之若干问题探讨(一)

    2024-02-05 10:46:03       32 阅读
  2. 网课:[SCOI2005]扫雷MINE——牛客(题解)

    2024-02-05 10:46:03       29 阅读
  3. 使用PySpark处理DataFrame以拆分数组列

    2024-02-05 10:46:03       33 阅读
  4. 初入软件测试行业,探寻成功之路

    2024-02-05 10:46:03       31 阅读
  5. linux c获取pid tid的几种方式

    2024-02-05 10:46:03       30 阅读
  6. MySQL 函数触发隐式转换应对策略

    2024-02-05 10:46:03       30 阅读
  7. “网络爬虫”是什么,他的原理是什么?

    2024-02-05 10:46:03       33 阅读
  8. 前端代码规范

    2024-02-05 10:46:03       36 阅读
  9. Pytorch: torch.linspace等间隔数值函数

    2024-02-05 10:46:03       34 阅读
  10. Lets-Encrypt配置泛域名证书

    2024-02-05 10:46:03       35 阅读
  11. Oracle常用命令

    2024-02-05 10:46:03       28 阅读
  12. 用爬虫自建行业知识库

    2024-02-05 10:46:03       26 阅读