You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Sambo Chea f65301ce4d Fixed cli and package for unknow cli 3 weeks ago
.github/workflows Fixed wrong branch 3 weeks ago
bin Fixed cli and package for unknow cli 3 weeks ago
data Changed the from people to source for default 3 weeks ago
.gitignore Add excel2json function and updated custom mapper from props 3 weeks ago
Dockerfile Changed the from people to source for default 3 weeks ago
LICENSE Initial commit 3 weeks ago
Makefile Updated build and fixed entry pint 3 weeks ago
README.md Fixed cli and package for unknow cli 3 weeks ago
build.sh Add excel2json function and updated custom mapper from props 3 weeks ago
excel2json.d.ts Fixed export module and add test and clean module and export declare function with props 3 weeks ago
excel2json.js Fixed export module and add test and clean module and export declare function with props 3 weeks ago
index.js Fixed export module and add test and clean module and export declare function with props 3 weeks ago
package.json Fixed cli and package for unknow cli 3 weeks ago
test.js Fixed export module and add test and clean module and export declare function with props 3 weeks ago
util.js Add cli support and updated functions 3 weeks ago

README.md

excel2json-xlsx

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-xlsx -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