Skip to main content

Spreadsheet utilities for Python

Project description

spreadsheet-toolkit

Tests PyPI version Python License: MIT

Spreadsheet utilities for Python.

Status: early development (v0.1.0).

Installation

pip install spreadsheet-toolkit

Dependencies

  • openpyxl (>=3.1.0) — for reading .xlsx files

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:

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spreadsheet_toolkit-0.1.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spreadsheet_toolkit-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

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

Hashes for spreadsheet_toolkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 de12e03738c937d48590ab27d2431b7faedf813e2f8ed842d1009d3aa5e2bd7f
MD5 f42cff466283aa25b80354654cde3671
BLAKE2b-256 43c30f6fac1148582ff4cac9ffafe9b3f535a39ddce7ebbedfaea3b9e06f1ace

See more details on using hashes here.

File details

Details for the file spreadsheet_toolkit-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for spreadsheet_toolkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ac81d3ee90345bc997d972ff5269bc9202a9372da3011b7257511c41ca9c137e
MD5 90c3bbbfe4da43bd9866368beacde54d
BLAKE2b-256 e503e8d85afbb71aa5f5a98f71fbf1d61a49aad4769aabdcbfdfa2d97fe2e520

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page