xlparser
Parse excel(xlsx/xls/csv) to other format(csv, xlsx, json).
Install
pip install xlparser
# or
pip3 install xlparser
If you want to filter fields, it will be convenient with xcut.
pip install xcut
# or
pip3 install xcut
Usage
$ xlparser -h
xlparser [options] INFILE [OUTFILE]\n
options:\n
-h For help.\n
CLI Usage
From xlsx to csv.
$ xlparser source.xlsx new.csv
From csv to xlsx.
$ xlparser source.csv new.xlsx
From csv to json.
$ xlparser source.csv new.json
From xlsx to csv(stdout).
$ xlparser source.xlsx | head
$ xlparser src.xlsx | tee test.csv
name, score
"李雷,韩梅",15
小花,16
Use xcut to filter fields.
$ xlparser src.xlsx | xcut --from-csv -f name
name
"李雷,韩梅"
小花
$ xlparser src.xlsx | xcut --from-csv -f score,name
score,name
15,"李雷,韩梅"
16,小花
Convert xlsx to csv
$ xlparser src.xlsx test.csv;
$ cat test.csv
name, age
李雷,15
小花,16
Convert csv to json
$ xlparser test.csv test.json
[["name", "age"], ["李雷", "15"], ["小花", "16"]]
Module Usage
Parse any type of file
parse any type of file to rows:
>>> from xlparser import parse, saveCsv
>>> rows = parse('some.xlsx')
>>> list(rows)
[['foo', 'bar'], ['看', '我', '变']]
The parse function supports the following file formats: .csv, .xls, .xlsx .
Save to any type of file
Save rows to csv
>>> from xlparser import saveCsv
>>> rows = [['foo', 'bar'], ['看', '我', '变']]
>>> saveCsv(rows, 'test.csv')
Save rows to xlsx
>>> saveXlsx(rows, 'test.xlsx')
Csv operation
>>> from xlparser import *
>>> rows = [('foo','bar'), ('看','我','变')]
>>> saveCsv(rows, 'test.csv')
>>> list(parseCsv('test.csv'))
[['foo', 'bar'], ['看', '我', '变']]
Zip operation
>>> from xlparser import loadZip
>>> zf = loadZip('test.xlsx')
>>> print(zf.filelist)
......
>>> zf.extract('xl/media/image1.png', '/tmp')
>>> os.rename('/tmp/'+'xl/media/image1.png', './image1.png')
Required
- python>=3.5
- xlrd: required by xls
- openpyxl>=2.5.4: required by xlsx
Metadata
Release files for xlparser 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| xlparser-0.6.1.tar.gz | 6.4 kB | Without provenance | Details for xlparser-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xlparser-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for xlparser-0.6.1-py3-none-any.whl |
Total release size: 14.1 kB
Release files / xlparser-0.6.1.tar.gz
| Download URL | xlparser-0.6.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2427ec8d777f67601890287e7ae2c90c565cae67db87a4348413c80e79d24040
|
|
BLAKE2b-256 checksum How to use checksums |
7ea7c8927b7c2b29fc6f69710579ba30a4a4ff7c1441ed6313fa3eafbfea45fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.2 Darwin/21.6.0
|
Release files / xlparser-0.6.1-py3-none-any.whl
| Download URL | xlparser-0.6.1-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
68e33c520ce6704817c713e765f35618f0b368e114b50ce4cb06ee259d8364dc
|
|
BLAKE2b-256 checksum How to use checksums |
4ea2613514190de98111f738cf86534ffeb074d090148c1ecda10fe5308e7e30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.2 Darwin/21.6.0
|
Security for xlparser 0.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.