Skip to content

Omasheet v0.1.6

Choose a tag to compare

@librasteve librasteve released this 31 Oct 12:26
· 292 commits to main since this release

Omasheet is a text-native spreadsheet: plain-text .omx files of named, typed sheets, with formulas in OMX and exact arithmetic.

Install or update

On Omarchy and Arch Linux, x86_64 or aarch64:

curl -fsSL https://raw.githubusercontent.com/librasteve/omasheet/main/install.sh | bash

If pacman cannot satisfy a dependency on qt6, run sudo pacman -Syu and then the line above again.

Polars underneath

Omasheet now uses Polars for its numbers, types and big tables. Where a column's formula has the same answer in Polars, Polars calculates it in one pass; otherwise the engine does as before.

Names changed — older files may need editing

OMX now uses the Polars names. An old name is reported as unknown; there is no automatic rename.

  • Types: Bool → Boolean, Text → String, Num → Float, DateTime → Datetime. A blank cell is Null.
  • Functions: avg → mean, eom → month_end, to_zone → convert_time_zone, asin → arcsin.
  • count counts what is not empty, and the new len counts rows.
  • round(x, 2) rounds to two decimal places; write round(x / 100) * 100 for a nearest multiple.
  • Complex is gone. A Decimal is a 38-digit fixed point and an Int an i64; Fraction is a way of showing a decimal, 1/7 or 2 3/4.

New functions: len, median, std, var, quantile, product, first, last, head, tail, shift, is_null, is_not_null, fill_null, is_in, cast, month_start, quarter, week, ordinal_day, is_nan, is_not_nan.

Parquet

table Passengers := dataframe["titanic.parquet"]

A sheet can read its rows from a Parquet file. It takes the file's columns, reads only the columns a formula asks for, and is read-only; its tab shows the file and the number of rows. omasheet import reads a .parquet and omasheet export --parquet writes one per sheet, and the app opens and exports Parquet too. With --meta, the export keeps the formulas, so importing the file again brings back the computed columns.

Sheets calculated from other sheets

sheet Dearest  := Passengers |> sort(Fare, desc) |> select(Name, Fare) |> head(5)
sheet ByRegion := Sales |> group_by(Region) |> agg(Revenue.sum(), Orders := Item.len())
sheet Both     := Sales |> join(Targets, Month, left)

filter, sort, select, head and tail pick and order rows, group_by … agg makes one row per group, and join pairs the rows of two sheets where their keys match. [Revenue; *-1 by Region] reads the row before within the same region, for a running total per region. A sheet can also be just := lines, as long as the sheets its formulas read.

In the app, a column can be sorted and filtered from its header.

New types

  • Duration, written in ISO 8601: PT30M, P1DT6H, P2W. Subtracting two dates or times gives one; total_days, total_hours, total_minutes and total_seconds turn it into a number.
  • Hex, Octal and Binary: 0xff, 0o17, 0b101, with the bitwise operators +&, +|, +^ and the shifts +< and +>, written as in Raku.
  • Url, Email and Uuid: text that is checked when it is entered, or converted in a formula with Email(x).
  • Times hold fractions of a second, and a column can declare its time zone.

Formats on a column

Price : Decimal['.2f]
Due   : Date[%d %b %Y]

A format in brackets after a column's type sets how its cells are shown, in the CLI, in Markdown and in the app.

In the app

  • The formula box opens to four lines for a formula over several lines; Alt+Enter adds a newline.
  • The function directory is divided into sections you can open and close.
  • Rows or columns that were cut or copied are inserted in place of blank ones.
  • Ctrl+Alt+N opens a new file.