Author: Prince
Start Date: 01-Feb-2025
This project is a command-line spreadsheet program developed in C, supporting integer-only cell values, formulas, and efficient recalculation using a Directed Acyclic Graph (DAG). It mimics core functionalities of Excel such as cell assignment, formula evaluation, and dependency tracking, all within a terminal interface.
- 📊 Spreadsheet Grid: Supports sizes from 1x1 up to 999x18278 (A1 to ZZZ999).
- 🔗 Formula Evaluation: Supports arithmetic operations and range-based functions (e.g., SUM(A1:A5)).
- 🔄 Efficient Recalculation: Uses topological sorting and a calculation chain for updating only necessary cells.
- ♻️ Dependency Management: Tracks dependencies and dependents for each cell using CellRange structs.
- ⛔ Error Handling: Detects circular references, invalid inputs, and handles edge cases like division by zero.
- 🧪 Testing Suite: Modular unit tests for formula parsing, input handling, and recalculation.
- 🧱 Modular Design: Divided into reusable modules for better maintainability and scalability.
- cell** grid: 2D array for cells.
- calculation_chain[]: Optimized recalculation order.
- CommandStatus: Stores status and execution time of last command.
- Tokenizes and classifies inputs using enums.
- Validates syntax for cell assignments, formulas, function calls, and scroll commands.
- Dirty flag mechanism for tracking updates.
- Topological sorting to determine update order.
- Selective recalculation based on dependencies.
- Invalid syntax detection.
- Circular reference prevention.
- Graceful handling of undefined operations (e.g., A1=10/0).
.
├── include/               # Header files
│   ├── spreadsheet.h
│   ├── recalculation.h
│   ├── input_handler.h
│   └── ...
├── src/                   # Source files
│   ├── spreadsheet.c
│   ├── recalculation.c
│   ├── input_handler.c
│   └── ...
├── lib/                   # Utility functions
│   └── utils.c
├── tests/                 # Unit tests
│   ├── test_input.c
│   ├── test_formula.c
│   └── ...
├── Makefile               # Build automation
└── report/                # LaTeX report files
    └── report.pdf
A Linux, macOS, or Windows system with:
- GCC (GNU Compiler Collection)
- makeor- mingw32-make
- pdflatexfor LaTeX report generation (optional)
# Clone the repository
git clone https://github.com/evans-prince/Command-Line-Excel.git
cd Command-Line-Excel/Command-Line-Excel
# Build the project
make
# Run the program
./target/release/spreadsheet 999 18278# Open Command Prompt (cmd) or Git Bash
# Clone the repository
git clone https://github.com/evans-prince/Command-Line-Excel.git
cd Command-Line-Excel\Command-Line-Excel
# Build the project
mingw32-make
# Run the program
.target/release/spreadsheet.exe 999 18278# Run provided tests (Linux/macOS)
make test
# Run tests on Windows
mingw32-make test
# Clean build files
make clean         # Linux/macOS
mingw32-make clean # Windows- 📁 GitHub Repository: Command-Line Excel
- 📽️ Demo Video: Watch Demo
This project was collaboratively developed by:
- 👨💻 Prince
- 👨💻 Aditya
If you'd like to know more or contribute, feel free to open an issue or contact us via GitHub!