hardcalc

A spreadsheet for the terminal, saved as Markdown.

Tables with types and units, formulas, layers, charts and traceable calculations – in plain text files you can read anywhere and diff in Git.

# macOS / Linux brew install hardcalc/tap/hardcalc # or from source cargo install --git https://github.com/hardcalc/hardcalc

The file is the document

A hardcalc file is valid Markdown. Any viewer shows the headings, text and tables; hardcalc also reads the types, formulas, layers and charts kept in fenced blocks. A plain Markdown table is already a valid matrix.

budget.hcmd
```types
Euro   = decimal(2) unit "€"
Status = enum(open, paid, cancelled)
```

## Expenses :: matrix[*, 5]

| Item     | Amount:Euro | Status | Share:decimal(3) | Gross:Euro     |
|----------|------------:|--------|------------------|----------------|
| Rent     |     1200.00 | paid   | =B1/sum(B)       | =Amount        |
| Power    |       85.50 | open   | =B2/sum(B)       | =Amount * 1.19 |
| Internet |       39.99 | paid   | =B3/sum(B)       | =Amount * 119% |

```layer format
D: percent(1)
row[Status=open]: fg yellow
```

Rent is {=Expenses[Rent, Share] | percent(1)} of the expenses.
in the terminal, in print and as PDF
Expenses
Item        Amount [€]  Status   Share   Gross [€]
Rent           1200.00  paid    90.5 %     1200.00
Power            85.50  open     6.5 %      101.75
Internet         39.99  paid     3.0 %       47.59

Rent is 90.5 % of the expenses.
a calculation sheet: ```hardcalc
q_d  = 1.35·g_k + 1.5·q_k = 1.35·4.0 + 1.5·3.0 = 9.90 kN/m
M_Ed = q_d·L^2/8 = 9.90·5.0^2/8 = 30.9 kN·m
σ_Ed = M_Ed/W_y = 30.9/324 = 95.5 N/mm²
σ_Ed = 95.5 N/mm² ≤ f_yd = 214 N/mm²   η = 0.45 ✓

What it does

Keyboard first, with full mouse support. Runs on macOS, Linux and Windows.

Vectors, matrices, tensors

Every table has a shape. Tensors have named axes and turn into a pivot view; slices and scenarios stack levels on a table.

Types with units

Base types and your own, like Euro = decimal(2) unit "€". Units are checked when calculating: € + m is an error.

Layers

As in CAD, formatting, validation rules, comments and formula highlighting live on layers you can show, hide and edit one at a time.

Formulas you know

Excel functions like sumif and xlookup, references by name, footer rows, and your own functions like LAMBDA.

Reports

Charts, running text with live values, grid layouts with page breaks, printing and PDF – all from the same file.

Calculation sheets

Engineering calculations with units, named variables and the way to the result, typeset as a PDF report through Typst.

Works with what you have

Import and export xlsx, xls, ods and CSV. A LibreOffice extension opens .hcmd files directly in Calc and saves them back without touching anything Calc does not know.

hardconf – TOML with a built-in schema

The second program edits TOML configuration files. A schema in a comment block at the end of the file brings types, defaults, choices and documentation; the file stays plain TOML.