asopi tech
asopi techIndie Developer

Asopitech With · Spreadsheet

Google Sheets with Alopex DB

Google Sheets is a spreadsheet that aggregates data with formulas and pivot tables. How would we make it with Alopex DB?

Updated: Oct 12, 2026

What the service does

A Google Sheets-like spreadsheet lets people write formulas in cells, summarize data with pivot tables and charts, and edit the same sheet together. It is a common tool for keeping daily records and summarizing them later. The data is records that grow row by row, and the summaries made from them.

Where the data lives

  • Columnar tables: records that keep growing, such as sales, hours worked or access logs, live in columnar tables. Each column is stored compressed, and aggregation reads only the columns it needs.
  • Loading: CSV and Parquet files are loaded with COPY, and records from apps arrive in batches through HTTP ingest.
  • SQL aggregation: in place of pivots, GROUP BY and window functions give monthly figures, per-owner totals and month-over-month change. Results become views that read the same way every time.

Deployment

Analysts read the same data through the Python and DataFrame clients. A notebook opens Alopex DB embedded and works with the results directly as DataFrames. Records shared by a team live on the Alopex DB server, with ingest over HTTP and analysis from Python.

Why Alopex DB fits

The more records there are, the heavier a spreadsheet gets. Alopex DB columnar tables are the place to aggregate growing records with SQL and DataFrames. They sit in the same database as row tables, so joins with master tables stay in SQL.

See it in code

Growing records are kept, and monthly totals per owner plus month-over-month come from SQL instead of a pivot. Just the aggregation core.

import alopex

db = alopex.Database.open("sheets.alopex")

# 増えていく記録(売上)をためる
db.execute_sql("""
    CREATE TABLE IF NOT EXISTS sales (
        month TEXT,
        dept TEXT,
        amount INTEGER
    )
""")

records = [
    ("2026-07", "東京", 100), ("2026-07", "大阪", 80),
    ("2026-08", "東京", 150), ("2026-08", "大阪", 90),
    ("2026-09", "東京", 120), ("2026-09", "大阪", 110),
]
for month, dept, amount in records:
    db.execute_sql("INSERT INTO sales (month, dept, amount) VALUES (?, ?, ?)", [month, dept, amount])

# 担当別・月別の合計と、前月比(担当ごとの LAG)を出す
rows = db.execute_sql("""
    WITH monthly AS (
        SELECT month, dept, SUM(amount) AS total
        FROM sales
        GROUP BY month, dept
    )
    SELECT month, dept, total,
           total - LAG(total) OVER (PARTITION BY dept ORDER BY month) AS mom
    FROM monthly
    ORDER BY dept, month
""")

for row in rows:
    print(row["dept"], row["month"], row["total"], "前月比", row["mom"])

GROUP BY rolls up by owner and month, and a window function gives the per-owner month-over-month; save it as a view to read the same shape again.

With columnar tables, SQL aggregation and Python DataFrames together, Alopex DB is our recommendation for logging and analysis. You can begin with the quickstart.