calpine-node/examples/excel2json/README.md

61 lines
907 B
Markdown
Raw Permalink Normal View History

2021-03-29 19:27:06 +07:00
# excel2json
2021-03-29 17:57:52 +07:00
- Read file excel to json
2021-03-29 19:27:06 +07:00
- Custom mapping with custom columns and configs
2021-03-29 17:57:52 +07:00
# Build
2021-03-29 19:27:06 +07:00
2021-03-29 17:57:52 +07:00
```shell
bash build
```
2021-03-29 19:27:06 +07:00
2021-03-29 17:57:52 +07:00
OR
2021-03-29 19:27:06 +07:00
2021-03-29 17:57:52 +07:00
```shell
make build run
```
# Example
2021-03-29 19:27:06 +07:00
2021-03-29 17:57:52 +07:00
```shell
docker run -v /my/path:/app/data --rm -it cubetiq/node-excel2json
```
```shell
docker run -v /home/sombochea/excel2json:/app/data -e APP_NAME="EXCEL 2 JSON" -e MAPPER_FILE="./data/mapper.json" --rm -it cubetiq/node-excel2json
```
2021-03-29 19:05:12 +07:00
# Mapper Config
2021-03-29 19:27:06 +07:00
2021-03-29 19:05:12 +07:00
```json
{
"data": [
{
"dataIndex": "Name",
"label": "Name"
},
{
"dataIndex": "Age",
"label": "Age"
}
],
2021-03-29 19:27:06 +07:00
"configs": {
"outputPath": "./data/outputs/exported",
"outputName": "my_exported_data",
2021-03-29 19:48:59 +07:00
"sheetName": "Sheet1",
"saveToOutput": true
2021-03-29 19:27:06 +07:00
}
2021-03-29 19:05:12 +07:00
}
```
2021-03-29 17:57:52 +07:00
# Environment
2021-03-29 19:27:06 +07:00
2021-03-29 17:57:52 +07:00
```env
APP_NAME=custom app name
2021-03-29 19:03:57 +07:00
INPUT_FILE=./data/mydata.xlsx
2021-03-29 17:57:52 +07:00
OUTPUT_PATH=./data/outputs
MAPPER_FILE=./data/mapper.json
2021-03-29 18:35:49 +07:00
SHEET_NAME=Sheet1
ENCODING=utf-8
2021-03-29 19:03:57 +07:00
```