xl_tables
Use descriptors to get and set Excel table values.
Update
Version 2.0.0 attempts to support openpyxl in the event you do not have Excel on your machine. This support is incomplete and does not have all of the Constants and methods populated. Switching between backends may not be supported.
Another change is how we import the constants. All constants were moved to xl_tables.constants In older versions you could use xl_tables.xlDouble. Now you must use xl_tables.constants.xlDouble
To change the backend call xl_tables.change_backend(windows=True).
Examples
import xl_tables as xl
import datetime
class MyTable(xl.Table):
label_first = xl.Constant('First Name', (1, 1)) # Constants initialize their value on Table creation
first_name = xl.Cell((1, 2))
label_last = xl.Constant('Last Name', (2, 1))
last_name = xl.Cell(2, 2)
label_now = xl.Constant('Now', (3, 1))
now = xl.DateTime(3, 2)
label_today = xl.Constant('Today', (4, 1))
today = xl.Date(4, 2)
label_time = xl.Constant('Time', (5, 1))
time = xl.Time(5, 2)
header = xl.Constant(['Data 1', 'Data 2', 'Data 3'], rows=7, row_length=3)
array_item = xl.RangeItem('A8:C10') # Contiguous Range is preferable
array = xl.Range('A8:C10')
# array_item = xl.RowItem(8, 9, 10, row_length=3)
# array = xl.Row(8, 9, 10, row_length=3)
tbl = MyTable()
tbl.first_name = 'John'
tbl.last_name = 'Doe'
tbl.now = datetime.datetime.now()
tbl.today = datetime.datetime.today()
tbl.time = datetime.time(20, 1, 1) # datetime.datetime.now().time()
tbl.array = [(1, 2, 3),
(4, 5, 6),
(7, 8, 9)]
# Make a border around the cells in the table
tbl.array_item.Borders(xl.xlEdgeTop).LineStyle = xl.xlDouble
text = '{lbl1} = {opt1}\n' \
'{lbl2} = {opt2}\n' \
'{lbl3} = {now}\n' \
'{lbl4} = {today}\n' \
'{lbl5} = {time}\n' \
'\n' \
'{header}\n' \
'{arr}\n'.format(lbl1=tbl.label_first, opt1=tbl.first_name, lbl2=tbl.label_last, opt2=tbl.last_name,
lbl3=tbl.label_now, now=tbl.now, lbl4=tbl.label_today, today=tbl.today,
lbl5=tbl.label_time, time=tbl.time,
header=tbl.get_row_text(tbl.header, delimiter=', '),
arr=tbl.get_table_text(tbl.array, delimiter=', '))
with open('person_text.txt', 'w') as f:
f.write(text)
print('===== Manual Text =====')
print(text)
print('===== End =====')
# Short function provided for this
txt = tbl.get_table_text(tbl.array, header=tbl.header, head={tbl.label_first: tbl.first_name,
tbl.label_last: tbl.last_name,
tbl.label_now: tbl.now,
tbl.label_today: tbl.today,
tbl.label_time: tbl.time})
print('===== Get Table Text =====')
print(txt)
print('===== End =====')
tbl.save('person.txt') # 'person.txt' or '.tsv' will save every cell separated by '\t'
tbl.save('person.csv') # 'person.csv' will save every cell separated by ','
tbl.save('person.xlsx')
Metadata
Release files for xl-tables 2.0.0
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 |
|---|---|---|---|---|
| xl_tables-2.0.0.tar.gz | 45.1 kB | Without provenance | Details for xl_tables-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| xl_tables-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for xl_tables-2.0.0-py3-none-any.whl |
Total release size: 87.0 kB
Release files / xl_tables-2.0.0.tar.gz
| Download URL | xl_tables-2.0.0.tar.gz |
|---|---|
| Size | 45.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5b16beb283e258efab54827ca6fd5c5fe6002bc541700151354cc81cae42d18a
|
|
BLAKE2b-256 checksum How to use checksums |
05fe59908ce900df7241705e4265e9ae4ad15a3a0d2832ac0367a3e54fdae67f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Release files / xl_tables-2.0.0-py3-none-any.whl
| Download URL | xl_tables-2.0.0-py3-none-any.whl |
|---|---|
| Size | 41.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fc534c7c213278aa4bdc474adc566d2d90edd9024b614f150e7815a86ce52679
|
|
BLAKE2b-256 checksum How to use checksums |
568abca5d619daf1a9c2f7b17acf7ee7691a803615467182984c0ae19516d073
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.0
|
Security for xl-tables 2.0.0
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.