Spreadsheet utilities for Python
Project description
spreadsheet-toolkit
Spreadsheet utilities for Python.
Status: early development (v0.1.0).
Installation
pip install spreadsheet-toolkit
Dependencies
- openpyxl (>=3.1.0) — for reading
.xlsxfiles
Usage
import_sheets
Return the list of sheet names in a workbook.
from spreadsheet_toolkit import import_sheets
import_sheets("budget.xlsx")
# ['Income', 'Expenses', 'Summary']
import_cells
Import cell values from a spreadsheet. Optionally select a sheet (by name or 1-based index) and a row/column range.
from spreadsheet_toolkit import import_cells
# All cells from the active sheet
import_cells("data.xlsx")
# [[10, 20, 30], ['hello', 'world', None], [3.14, True, None]]
# A specific sheet by name
import_cells("data.xlsx", sheet="Summary")
# [['total', 150]]
# A specific sheet by index
import_cells("data.xlsx", sheet=2)
# Rows 2-3, columns 1-2
import_cells("data.xlsx", rows=(2, 3), columns=(1, 2))
# [['hello', 'world'], [3.14, True]]
import_formulas
Like import_cells, but formula cells return their formula string instead of the computed value.
from spreadsheet_toolkit import import_formulas
import_formulas("data.xlsx")
# [[10, 20, '=A1+B1'], ['hello', 'world', None], [3.14, True, '=SUM(A1:B1)']]
import_formulas("data.xlsx", sheet="Summary")
# [['total', '=Data!A1+Data!B1']]
spreadsheet_index_to_position
Convert a cell reference (e.g. "A1", "AA12") to a (row, column) tuple with 1-based indices.
from spreadsheet_toolkit import spreadsheet_index_to_position
spreadsheet_index_to_position("A1")
# (1, 1)
spreadsheet_index_to_position("C5")
# (5, 3)
spreadsheet_index_to_position("AA1")
# (1, 27)
position_to_spreadsheet_index
Convert a (row, column) position back to a cell reference string.
from spreadsheet_toolkit import position_to_spreadsheet_index
position_to_spreadsheet_index(1, 1)
# 'A1'
position_to_spreadsheet_index(5, 3)
# 'C5'
position_to_spreadsheet_index(1, 27)
# 'AA1'
See also
This Python package includes a translation of the following Wolfram Language functions:
- SpreadsheetIndexToPosition (resource function by S. Smit)
- PositionToSpreadsheetIndex (resource function by S. Smit)
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 spreadsheet_toolkit-0.1.0.tar.gz.
File metadata
- Download URL: spreadsheet_toolkit-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de12e03738c937d48590ab27d2431b7faedf813e2f8ed842d1009d3aa5e2bd7f
|
|
| MD5 |
f42cff466283aa25b80354654cde3671
|
|
| BLAKE2b-256 |
43c30f6fac1148582ff4cac9ffafe9b3f535a39ddce7ebbedfaea3b9e06f1ace
|
File details
Details for the file spreadsheet_toolkit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spreadsheet_toolkit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac81d3ee90345bc997d972ff5269bc9202a9372da3011b7257511c41ca9c137e
|
|
| MD5 |
90c3bbbfe4da43bd9866368beacde54d
|
|
| BLAKE2b-256 |
e503e8d85afbb71aa5f5a98f71fbf1d61a49aad4769aabdcbfdfa2d97fe2e520
|