A python library for reading and writing Excel files, converting between xlsx and dict or text
Project description
xlsx2dict
A Python library for reading and writing Excel files, converting between xlsx and dict or text.
Installation
pip install xlsx2dict
Usage
Python API
from xlsx2dict import sheets, read, read_dict, write, write_dict, xlsx2text
# List sheet names
sheet_names = sheets("example.xlsx")
# Read a sheet as list of lists
data = read("example.xlsx", sheet_name="Sheet1")
# Read a sheet as ordered dict (keyed by row number)
d = read_dict("example.xlsx", sheet_name="Sheet1")
d = read_dict("example.xlsx", sheet_name="Sheet1", head_rows=2) # multi-row headers
d = read_dict("example.xlsx", sheet_name="Sheet1", save_list=True) # include raw row as __list__
d = read_dict("example.xlsx", sheet_name="Sheet1", key_map={"Old": "New"}) # rename columns
# Write list of lists to xlsx
write([["Name", "Age"], ["Alice", 30]], "output.xlsx", sheet_name="Data")
# Write dict to multi-sheet xlsx
write_dict("output.xlsx", {
"Sheet1": [["Name", "Age"], ["Alice", 30]],
"Sheet2": [["City", "Country"], ["Paris", "France"]],
})
# Convert xlsx to formatted text
xlsx2text("example.xlsx") # prints all sheets
xlsx2text("example.xlsx", index=1) # prints first sheet
xlsx2text("example.xlsx", output_file="out.txt") # write to file
CLI
# Convert all sheets to console
xlsx2text example.xlsx
# Convert a specific sheet
xlsx2text example.xlsx -i 1
# Save output to file
xlsx2text example.xlsx -o output.txt
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xlsx2dict-0.1.2.tar.gz.
File metadata
- Download URL: xlsx2dict-0.1.2.tar.gz
- Upload date:
- Size: 24.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
049817d2d07d26975596b89988e1cf0bf59b1e159f16bf0bbf8a272f12c1b16a
|
|
| MD5 |
5d35631aaa5b19db90f4102437252dee
|
|
| BLAKE2b-256 |
0589703a517d2844aee67ebabb49d3b4da28574a940a2c1099b37f883c7737d8
|
Provenance
The following attestation bundles were made for xlsx2dict-0.1.2.tar.gz:
Publisher:
publish.yml on huanghhhz/xlsx2dict
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xlsx2dict-0.1.2.tar.gz -
Subject digest:
049817d2d07d26975596b89988e1cf0bf59b1e159f16bf0bbf8a272f12c1b16a - Sigstore transparency entry: 1980450858
- Sigstore integration time:
-
Permalink:
huanghhhz/xlsx2dict@d31934045027bd783f287ac852354b1ed09284f2 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/huanghhhz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d31934045027bd783f287ac852354b1ed09284f2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file xlsx2dict-0.1.2-py3-none-any.whl.
File metadata
- Download URL: xlsx2dict-0.1.2-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc65954ae9f31c8afc16411c4fa0a58cac810130cd76b4efdd735e08b495b4af
|
|
| MD5 |
5fb0c1720bd6c690c2a445bd80a2bb64
|
|
| BLAKE2b-256 |
067c9d5267a7659fa619a19e75bd21dee6a9632a2b51b618979968852ac6932e
|
Provenance
The following attestation bundles were made for xlsx2dict-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on huanghhhz/xlsx2dict
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
xlsx2dict-0.1.2-py3-none-any.whl -
Subject digest:
dc65954ae9f31c8afc16411c4fa0a58cac810130cd76b4efdd735e08b495b4af - Sigstore transparency entry: 1980450965
- Sigstore integration time:
-
Permalink:
huanghhhz/xlsx2dict@d31934045027bd783f287ac852354b1ed09284f2 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/huanghhhz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d31934045027bd783f287ac852354b1ed09284f2 -
Trigger Event:
push
-
Statement type: