Skip to main content

Drop-in replacement for openpyxl that connects to XLSX Studio for real-time collaboration

Project description

athena-python-xlsx

Drop-in replacement for openpyxl that connects to XLSX Studio for real-time collaboration.

Installation

pip install athena-python-xlsx

Quick Start

from openpyxl import Workbook
from openpyxl.styles import Font, PatternFill, Alignment

# Create a new workbook
wb = Workbook.create(name="Sales Report")
ws = wb.active

# Headers
headers = ["Product", "Q1", "Q2", "Q3", "Q4", "Total"]
for col, header in enumerate(headers, 1):
    cell = ws.cell(row=1, column=col, value=header)
    cell.font = Font(bold=True, size=12)
    cell.fill = PatternFill(fgColor="4472C4")
    cell.alignment = Alignment(horizontal="center")

# Data
data = [
    ["Widget A", 150, 200, 180, 220],
    ["Widget B", 300, 280, 350, 400],
    ["Widget C", 100, 120, 90, 110],
]

for row_idx, row_data in enumerate(data, 2):
    for col_idx, value in enumerate(row_data, 1):
        ws.cell(row=row_idx, column=col_idx, value=value)
    # Total formula
    ws.cell(row=row_idx, column=6, value=f"=SUM(B{row_idx}:E{row_idx})")

# Column widths
ws.column_dimensions['A'].width = 15

# Save
wb.save("sales_report.xlsx")

Configuration

Set these environment variables:

export ATHENA_XLSX_BASE_URL=https://api.xlsx-studio.com
export ATHENA_XLSX_API_KEY=your-api-key  # optional

Or pass them directly:

wb = Workbook(workbook_id="wb_123", base_url="https://api.xlsx-studio.com")

Athena Assets

To connect to an existing Athena spreadsheet asset, pass the org_id parameter:

wb = Workbook(
    workbook_id="asset_5a9fbe63-a63f-4ba3-8d3d-11231bbb67dc",
    base_url="https://api.xlsx-studio.com",
    org_id="workspace_5fd97d12-eda1-4191-82e5-b6fe5cb61dcc",
)
ws = wb.active
ws['A1'] = "Hello from Python!"
wb.close()  # Flushes changes

How It Works

This SDK implements the openpyxl API surface as a proxy layer over the XLSX Studio API:

  • Read path: GET /workbooks/{id}/snapshot → JSON → Python proxy objects (Workbook, Worksheet, Cell)
  • Write path: Property setter → Command dataclass → CommandBuffer → POST /workbooks/{id}/commands → server applies to Yjs Y.Doc
  • Export path: POST /workbooks/{id}/export → server rebuilds XLSX from Y.Doc → download

Changes are applied in real-time via Yjs, so other users see edits instantly in the browser.

API Compatibility

Feature Status
Cell values (str, int, float, bool)
Formulas
Cell styles (Font, Fill, Border, Alignment)
Number formats
Column widths / Row heights
Merged cells
Insert/Delete rows/columns
Freeze panes
Auto-filter
Sheet operations (add, remove, rename, copy)
Workbook properties
Charts 🚧 Planned
Images 🚧 Planned
Conditional formatting 🚧 Planned
Data validation 🚧 Planned
Pivot tables 🚧 Planned

Batch Operations

By default, commands are auto-batched with a 2-second debounce timer. For explicit control:

# Explicit batch - all commands sent in one request
with wb.batch():
    for row in range(1, 1001):
        ws.cell(row=row, column=1, value=f"Row {row}")

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

athena_python_xlsx-0.1.0.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

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

athena_python_xlsx-0.1.0-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

Details for the file athena_python_xlsx-0.1.0.tar.gz.

File metadata

  • Download URL: athena_python_xlsx-0.1.0.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.6

File hashes

Hashes for athena_python_xlsx-0.1.0.tar.gz
Algorithm Hash digest
SHA256 99a98b00013757e4c3bbdd4e134693b0538b03acc3f660b5a42a913667fcd156
MD5 188c30606835047c7c98fcf8948b2dd3
BLAKE2b-256 49ae1dff8ccc3bca89f6e0aa39f3fd81cdae56f4fdf0d46db90ac414e2047f40

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for athena_python_xlsx-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6eb2b0f2b041c1ce1f4a1d64249a242c5b30d8b746f138f3398bec993c701a63
MD5 13898e86c5da1fd6175815e0c9c7606d
BLAKE2b-256 3cbed67cca4b9a441878a30d64dd73baa6338a75d5f9ae509f17d141127b1e3f

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