Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2b170c9bc0 | |||
|
|
88645b98ea | ||
| fa8d223311 | |||
| ab7a43a93f |
@@ -3,7 +3,7 @@ LABEL maintainer="sombochea@cubetiqs.com"
|
|||||||
|
|
||||||
VOLUME [ "/app/data" ]
|
VOLUME [ "/app/data" ]
|
||||||
|
|
||||||
ENV INPUT_FILE './data/people.xlsx'
|
ENV INPUT_FILE './data/source.xlsx'
|
||||||
ENV OUTPUT_PATH './data/outputs'
|
ENV OUTPUT_PATH './data/outputs'
|
||||||
ENV MAPPER_FILE './data/mapper.json'
|
ENV MAPPER_FILE './data/mapper.json'
|
||||||
|
|
||||||
|
|||||||
20
README.md
20
README.md
@@ -1,11 +1,13 @@
|
|||||||
# excel2json
|
# excel2json
|
||||||
|
|
||||||
[](https://github.com/CUBETIQ/excel2json/actions/workflows/npm-publish.yml)
|
[](https://github.com/CUBETIQ/excel2json/actions/workflows/npm-publish.yml)
|
||||||
[](https://github.com/CUBETIQ/excel2json/actions/workflows/docker-publish.yml)
|
[](https://github.com/CUBETIQ/excel2json/actions/workflows/docker-publish.yml)
|
||||||
|

|
||||||
|

|
||||||
|
|
||||||
- Read file excel to json
|
- Read file excel to json
|
||||||
- Custom mapping with custom columns and configs
|
- Custom mapping with custom columns and configs
|
||||||
- Custom props
|
- Custom props
|
||||||
|
- Docker suppport
|
||||||
|
|
||||||
# Install
|
# Install
|
||||||
```shell
|
```shell
|
||||||
@@ -21,7 +23,21 @@ yarn add global excel2json-xlsx
|
|||||||
```
|
```
|
||||||
Usage
|
Usage
|
||||||
```shell
|
```shell
|
||||||
excel2json-xlsx -i people.xlsx -o exported.json
|
excel2json-xlsx -i source.xlsx -o exported.json
|
||||||
|
```
|
||||||
|
OR
|
||||||
|
```shell
|
||||||
|
npx excel2json-xlsx -i source.xlsx -o exported.json
|
||||||
|
```
|
||||||
|
|
||||||
|
# [Docker Hub](https://hub.docker.com/r/cubetiq/excel2json)
|
||||||
|
***Pulling image***
|
||||||
|
```shell
|
||||||
|
docker pull cubetiq/excel2json
|
||||||
|
```
|
||||||
|
***Run container***
|
||||||
|
```shell
|
||||||
|
docker run --rm -it -v /my/path/data:/app/data cubetiq/excel2json -i ./data/source.xlsx -p true
|
||||||
```
|
```
|
||||||
|
|
||||||
# Build
|
# Build
|
||||||
|
|||||||
4
excel2json.d.ts
vendored
4
excel2json.d.ts
vendored
@@ -1,4 +1,4 @@
|
|||||||
interface Excel2JsonProps {
|
export interface Excel2JsonProps {
|
||||||
mappings?: Array<any>;
|
mappings?: Array<any>;
|
||||||
saveToOutput?: boolean;
|
saveToOutput?: boolean;
|
||||||
outputPath?: string;
|
outputPath?: string;
|
||||||
@@ -10,4 +10,4 @@ interface Excel2JsonProps {
|
|||||||
encoding?: string;
|
encoding?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
declare function excel2json(props: Excel2JsonProps);
|
export declare function excel2json(props: Excel2JsonProps);
|
||||||
|
|||||||
@@ -117,6 +117,6 @@ function _internalExport(props = {}) {
|
|||||||
*
|
*
|
||||||
* @returns JSON Object of result
|
* @returns JSON Object of result
|
||||||
*/
|
*/
|
||||||
module.exports = excel2json = (props = {}) => {
|
module.exports.excel2json = excel2json = (props = {}) => {
|
||||||
return _internalExport(props);
|
return _internalExport(props);
|
||||||
};
|
};
|
||||||
|
|||||||
11
index.js
11
index.js
@@ -1,10 +1,5 @@
|
|||||||
// import excel2json module
|
// import excel2json module
|
||||||
const excel2json = require("./excel2json");
|
const { excel2json } = require("./excel2json");
|
||||||
|
|
||||||
// called function export excel2json
|
// export the function
|
||||||
const exported = excel2json({
|
module.exports = excel2json;
|
||||||
inputFile: "./data/people.xlsx"
|
|
||||||
});
|
|
||||||
|
|
||||||
// output data from exported
|
|
||||||
console.log("Output =>\n", exported);
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "excel2json-xlsx",
|
"name": "excel2json-xlsx",
|
||||||
"version": "1.0.3",
|
"version": "1.0.5",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"excel",
|
"excel",
|
||||||
"json",
|
"json",
|
||||||
|
|||||||
Reference in New Issue
Block a user