https://github.com/miyako/4d-plugin-xlsxio
very simple XLSX library based on XLSXIO
https://github.com/miyako/4d-plugin-xlsxio
4d-plugin xlsx
Last synced: 11 days ago
JSON representation
very simple XLSX library based on XLSXIO
- Host: GitHub
- URL: https://github.com/miyako/4d-plugin-xlsxio
- Owner: miyako
- License: mit
- Created: 2017-08-16T05:01:29.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-08-27T04:53:34.000Z (almost 2 years ago)
- Last Synced: 2025-02-26T04:16:08.602Z (over 1 year ago)
- Topics: 4d-plugin, xlsx
- Language: C
- Homepage:
- Size: 19.9 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README


[](LICENSE)

**Note**: for v17 and earlier, move `manifest.json` to `Contents`
# 4d-plugin-xlsxio
very simple XLSX library based on [XLSXIO](https://github.com/brechtsanders/xlsxio)
## Syntax
```4d
json:=XLSX TO JSON (path;options;error)
```
Parameter|Type|Description
------------|------------|----
path|TEXT|location of ``.XLSX`` document
options|LONGINT|options
error|TEXT|on outout, error in ``JSON``; on input the sheet name to read
json|TEXT|values in ``JSON``
```4d
XLSX SHEET NAMES (path;names)
```
Parameter|Type|Description
------------|------------|----
path|TEXT|location of ``.XLSX`` document
names|TEXT ARRAY|sheet names
```4d
JSON TO XLSX (path;json;row_height;detection_rows;error)
```
Parameter|Type|Description
------------|------------|----
path|TEXT|location of ``.XLSX`` document
json|TEXT|values in ``JSON``
json|LONGINT|row height
json|LONGINT|number of rows used to detect column widths
error|TEXT|error in ``JSON``
* Options for ``XLSX TO JSON``
```c
XLSXIOREAD_SKIP_NONE 0
XLSXIOREAD_SKIP_EMPTY_ROWS 1
XLSXIOREAD_SKIP_EMPTY_CELLS 2
XLSXIOREAD_SKIP_ALL_EMPTY 3
XLSXIOREAD_SKIP_EXTRA_CELLS 4
```
## Remarks
Only the first sheet is exported with ``JSON TO XLSX``
All values are imported as text with ``XLSX TO JSON``
Values can be text, number, or bool with ``JSON TO XLSX``, but you would need to use ``Collection`` for that.
For more information see https://github.com/brechtsanders/xlsxio
## Examples
```4d
$path:=System folder(Desktop)+"sample.xlsx"
//all values are returned as string
$json:=XLSX TO JSON ($path;XLSXIOREAD_SKIP_EMPTY_ROWS;$json_e)
$xlsx:=JSON Parse($json)
$_err:=JSON Parse($json_e)
$row_height:=1 //set row height
$detection_rows:=10 //how many rows to buffer to detect column widths
$path:=System folder(Desktop)+"sample-copy.xlsx"
//only 1 sheet is supported
JSON TO XLSX ($path;$json;$row_height;$detection_rows;$json_e)
OPEN URL($path;"Microsoft Excel")
```