A CLI-based spreadsheet engine written in C.
Spreadsheet-Engine brings spreadsheet-like arithmetic and functions to the command line. You interact with the grid by entering formulas directly and navigating with simple key commands—no traditional spreadsheet GUI, but a true terminal experience!
- Direct formula entry: Assign cell values and formulas with statements like
A1=5
,B2=A1+10
, orC3=SUM(A1:B2)
. - Cell referencing: Use cell names (e.g.,
A1
,B2
,AA10
) in formulas, with multi-letter columns supported. - Basic math: Supports
+
,-
,*
,/
, parentheses, and negative numbers. - Functions: SUM, MIN, MAX, AVG, STDEV, SLEEP (for timing).
- Viewport navigation: Move through the spreadsheet using
w
(up),a
(left),s
(down), andd
(right) keys. - Instant feedback: Spreadsheet is printed automatically after every command.
- Robust error handling: Catches invalid formulas, cell references, and division by zero.
- Fast, minimal implementation: Built in portable C for educational and scripting use.
Requires a C99-compatible compiler and make
.
git clone https://github.com/akryptonian/Spreadsheet-Engine.git
cd Spreadsheet-Engine
make
Executable will be built in ./target/release/spreadsheet
.
./target/release/spreadsheet <rows> <cols>
For example:
./target/release/spreadsheet 20 20
- Assign a value/formula:
TypeA1=10
orB2=A1*2+5
and press Enter. - Use functions:
TypeC1=SUM(A1:B2)
orD1=AVG(A1:B2)
. - Navigate the viewport:
Use keys:w
— scroll upa
— scroll lefts
— scroll downd
— scroll right
- Disable output:
Typedisable_output
to stop printing the spreadsheet on each command.
Typeenable_output
to resume printing. - Quit:
Typeq
and press Enter.
Note: There are no commands like GET
, SET
, PRINT
, SAVE
, or LOAD
. All interactions are through formulas and simple navigation shortcuts.
A1=5
B1=3
C1=A1+B1*2
D1=SUM(A1:C1)
w # move viewport up
s # move viewport down
q # exit
After each formula or navigation command, the spreadsheet grid is automatically printed (unless disabled).
- Core functions:
set_cell
,get_cell
,print_spreadsheet
,parse_formula
,evaluate_expression
,evaluate_range
- Error handling: Invalid formulas, cell references, and arithmetic errors are caught and reported.
- Data structure: Dynamically allocated 2D grid of cells, with support for multi-letter columns.
- Persistent saving/loading of spreadsheet data (currently not implemented)
- More advanced functions
- GUI or TUI enhancements
MIT License. See LICENSE for details.
Made by akryptonian