node-xlsx-json

Converting xlsx file to json files using nodejs
Install
npm install simon-xlsx2json
Usage
xlsxj = require("xlsx-to-json");
xlsxj({
input: "sample.xlsx",
output: "output.json"
}, function(err, result) {
if(err) {
console.error(err);
}else {
console.log(result);
}
});
Specifying a target sheet
You can optionally provide a sheet name to extract from that sheet
xlsxj = require("xlsx-to-json");
xlsxj({
input: "sample.xlsx",
output: "output.json",
sheet: "tags"
}, function(err, result) {
if(err) {
console.error(err);
}else {
console.log(result);
}
});
In config object, you have to enter an input path. But If you don't want to output any file you can set to null.
License
MIT @chilijung
jq 操作 json
根据 index 获取数组中的某个元素
cat ./sample/DT_ALL.json | jq '.models | .[1]'
获取数组中某个属性的所有值
cat ./sample/DT_ALL.json | jq '.models | .[].name'
"EXCOOL"
"PHL402M"
获取 models 数组中 模版名为 EXCOOL 的 对象的 cols 的值
cat ./sample/DT_ALL.json | jq '.models[] | select(.name == "EXCOOL") | .cols'
21
获取 models 数组中 模版名为 EXCOOL 的 对象的 records 的值
cat ./sample/DT_ALL.json | jq '.models[] | select(.name == "EXCOOL") | .records'
获取 excool 中的 某条 Name 为 Adia Pump Overload 的 TextDisplay
cat ./sample/DT_ALL.json | jq '.models[] | select(.name == "EXCOOL") | .records[] | select(.Name == "Adia Pump Overload") | .TextDisplay'
同时根据多个条件来检索
使用 rclone 或者 mc 将文件上传到 minio
rclone copy ./sample/DT_ALL.json azure:/opt/model
mc cp ./sample/DT_ALL.json azure:/opt/model
remote->local
mc cp azure:/opt/model/EXCOOL.json ./sample/EXCOOL.json