node.js - 如何将 Xlsx / Xls 文件转换为 JSON 文件(例如 sample.json)Node JS
问题描述
我正在尝试将此excel表/文件转换为json文件作为输出而不是原始数据(sample.json),我搜索了很多资源,但我没有找到任何工作代码或教程,所以我需要一些帮助,我已经链接了图像是excell数据,我怎样才能将它转换成如下的json文件并上传到MongoDB中。
示例.json
{
"Sheet1": [
{
"Qusetion Number": "1",
"Question": "A program language",
"A": "defines the form of the instruction",
"B": "is always machine dependent",
"C": "is never machine dependent",
"D": "All of the above",
"E ": "None of the above",
"Answers": "defines the form of the instruction"
},
{
"Qusetion Number": "2",
"Question": "Quiestion 2",
"A": "Option A",
"B": "Option B",
"C": "Option C",
"D": "Option D",
"E ": "Option E ",
"Answers": "Option C"
},
{
"Qusetion Number": "3",
"Question": "Question 3",
"A": "Option 5",
"B": "Option 6",
"C": "Option 9",
"E ": "Option9",
"Answers": "Option 6"
},
{
"Qusetion Number": "4",
"Question": "Question 4",
"A": "456",
"B": "221",
"C": "889",
"Answers": "456"
}
]
}
解决方案
推荐阅读
- spring - 例外:使用 Spring Client 对 Spring 中的 http-epoll-1 线程进行泄漏检测
- c# - 在 C# 中,表达式 x = y == z 代表什么?
- javascript - Bootstrap 4 datetimepicker - 如何在发送值之间以不同的方式显示日期格式?
- c# - 在 ASP.NET Core 3 (3.0) SPA (Angular) 中如何正确检查用户角色?
- typescript - 打字稿:为什么它有效?
- python - python stanford core NLP中的依赖解析
- javascript - 添加/删除 cytoscape 样式
- c++ - 为模板传递非类型参数参数
- java - 是否有可能以这样的方式编写文本文件,当 Java 编译器读取时,它会在某些点添加换行符?
- python - 如何处理 Robot Framework 中的弹出窗口?