首页 > 解决方案 > 我无法将从数据库中提取的数据导出为 Node.JS 中的 Excel (.csv) 或 (xlsx) 格式

问题描述

我正在以 Json 格式从数据库中获取数据。

[
  {
    "name": "Raj",
    "age": 20,
    "fav-color": "blue"
  },
  {
    "name": "Rahul",
    "age": 23,
    "fav-color": "green"
  },
  {
    "name": "Vijay",
    "age": 21,
    "fav-color": "white"
  },
]

我希望将它放入 Excel 文件中,例如,

姓名|年龄|最喜欢的颜色

拉吉| 20| 蓝色的

拉胡尔|23 | 绿色

维杰|21 | 白色的

标签: mysqlnode.js

解决方案


You can use json parser to read the json document and exporting it into an excel file in your desired format using poi package.


推荐阅读