Go to file
2021-03-30 12:31:59 +07:00
.github/workflows Updated build and fixed entry pint 2021-03-30 12:05:29 +07:00
bin Uodated cli and add option to print to output 2021-03-30 12:20:48 +07:00
data Changed the from people to source for default 2021-03-30 12:31:21 +07:00
.gitignore Add excel2json function and updated custom mapper from props 2021-03-30 09:16:11 +07:00
build.sh Add excel2json function and updated custom mapper from props 2021-03-30 09:16:11 +07:00
Dockerfile Changed the from people to source for default 2021-03-30 12:31:21 +07:00
excel2json.d.ts Add cli support and updated functions 2021-03-30 11:21:58 +07:00
excel2json.js Fixed the ouput and variable and updated function 2021-03-30 11:47:54 +07:00
index.js Changed the from people to source for default 2021-03-30 12:31:21 +07:00
LICENSE Initial commit 2021-03-30 08:40:56 +07:00
Makefile Updated build and fixed entry pint 2021-03-30 12:05:29 +07:00
package.json Updated to version 1.0.4 2021-03-30 12:31:59 +07:00
README.md Changed the from people to source for default 2021-03-30 12:31:21 +07:00
util.js Add cli support and updated functions 2021-03-30 11:21:58 +07:00

excel2json

Node.js Package Docker CI Docker Image Size (latest by date) Docker Pulls

  • Read file excel to json
  • Custom mapping with custom columns and configs
  • Custom props
  • Docker suppport

Install

npm i excel2json-xlsx

OR

yarn i excel2json-xlsx

OR Global Install

yarn add global excel2json-xlsx

Usage

excel2json-xlsx -i source.xlsx -o exported.json

OR

npx excel2json -i source.xlsx -o exported.json

Docker Hub

Pulling image

docker pull cubetiq/excel2json

Run container

docker run --rm -it -v /my/path/data:/app/data cubetiq/excel2json -i ./data/source.xlsx -p true

Build

bash build

OR

make build run

Example

docker run -v /my/path:/app/data --rm -it cubetiq/node-excel2json
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

Mapper Config

{
  "data": [
    {
      "dataIndex": "Name",
      "label": "Name"
    },
    {
      "dataIndex": "Age",
      "label": "Age"
    }
  ],
  "configs": {
    "outputPath": "./data/outputs/exported",
    "outputName": "my_exported_data",
    "sheetName": "Sheet1",
    "saveToOutput": true
  }
}

Custom Function Props

{
    mappings: [
        {
            "dataIndex": "Name",
            "label": "Name"
        }
    ],
    saveToOutput: false
}

Environment

APP_NAME=custom app name
INPUT_FILE=./data/mydata.xlsx
OUTPUT_PATH=./data/outputs
MAPPER_FILE=./data/mapper.json
SHEET_NAME=Sheet1
ENCODING=utf-8