https://github.com/stla/jsonxlsx
Conversion xlsx - json, based on the Haskell library xlsx.
https://github.com/stla/jsonxlsx
haskell
Last synced: 10 months ago
JSON representation
Conversion xlsx - json, based on the Haskell library xlsx.
- Host: GitHub
- URL: https://github.com/stla/jsonxlsx
- Owner: stla
- License: bsd-3-clause
- Created: 2017-01-22T03:23:59.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-12T14:50:14.000Z (over 8 years ago)
- Last Synced: 2025-02-06T16:05:48.509Z (12 months ago)
- Topics: haskell
- Language: Haskell
- Homepage:
- Size: 85.9 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# jsonxlsx
## Executables
Compile the package with the flag `exe` to get two executables, namely
`json2xlsx` and `xlsx2json`.
Their usage is illustrated below.
See `json2xlsx --help` and `xlsx2json --help` to get additional information.
- Write a file with `json2xlsx`:
```
> json2xlsx -d {\"A\":[1,2],\"B\":[3,\"x\"]} --header -o outfile.xlsx
> json2xlsx -d {\"A\":[1],\"B\":[3,\"x\"]} --header -o outfile.xlsx
> json2xlsx -d {\"A\":[null,2],\"B\":[3,\"x\"]} --header -o outfile.xlsx
```
- Read it with `xlsx2json`:
```
> xlsx2json -f outfile.xlsx -s Sheet1 -w data --header
{"A":[null,2],"B":[3,"x"]}
```
Here the flag `data` tells to `xlsx2json` to read the cell values.
You can read the cell types:
```
> xlsx2json -f outfile.xlsx -s Sheet1 -w types --header
{"A":[null,"number"],"B":["number","text"]}
```
Or both the cell values and the cell types:
```
> xlsx2json -f outfile.xlsx -s Sheet1 -w "data,types" --header
{"data":{"A":[null,2],"B":[3,"x"]},"types":{"A":[null,"number"],"B":["number","text"]}}
```
You can specify a first row and a last row:
```
> xlsx2json -f outfile.xlsx -s Sheet1 -w data -F 2 -L 10
{"X1":[null,2],"X2":[3,"x"]}
```
- Write and read some comments:
```
> json2xlsx -d {\"A\":[null,2],\"B\":[3,\"x\"]} -c "{\"A\":[\"a comment\",null],\"B\":[null,\"another one\"]}" --header -o outfile.xlsx
```
```
> xlsx2json -f outfile.xlsx -s Sheet1 -w comments --header
{"A":["a comment",null],"B":[null,"another one"]}
```
It is also possible to read the cell formats:
```
> xlsx2json -f outfile.xlsx -s Sheet1 -w formats --header
{"A":[null,null],"B":[null,null]}
```
- Read all worksheets
Ignore the flag `-s` to read all sheets of a `xlsx` file:
```
> xlsx2json -f myfile.xlsx -w data --header
```