Convert spreadsheets (XLSM, CSV) into CMake-ready C++ library projects with mathematical expression support. Published on PyPI.
- Multi-format Support: Convert XLSM and CSV files to C++ libraries
- CMake Integration: Generates complete CMake projects ready to build
- Mathematical Expressions: Optional support for formula calculations using C++ Mathematical Expression Toolkit
- Header-only Option: Generate header-only libraries for easy integration
- Flexible Output: Choose between source/header pairs or header-only libraries
- Formula Preservation: Maintain spreadsheet formulas as executable C++ code
- Type Safety: Configurable type handling for strings and numeric values
Install from PyPI (recommended):
pip install spreadsheet-to-cpplibInstall from source:
pip install git+https://github.com/shajeen/spreadsheet-to-cpplib.git# Convert an Excel file
spreadsheet-to-cpplib --file="your_spreadsheet.xlsm"
# Convert a CSV file
spreadsheet-to-cpplib --file="your_data.csv"The tool will prompt you with configuration questions and generate the C++ library in an output/ directory.
When you run the tool, it will ask you several questions to customize the output:
| Question | Description | Options |
|---|---|---|
| Mathematical Expression Support | Include C++ Mathematical Expression Toolkit for formula calculations | yes / no |
| Header-only Library | Generate as header-only library (easier integration) | yes / no |
| Formula as String | Keep formulas as strings in the generated code | yes / no |
| String to Zero Conversion | Convert string values to 0.0 in numeric contexts | yes / no |
your-project/
βββ src/
β βββ spreadsheet_to_cpplib/ # Main source code
βββ docs/ # Documentation
βββ tests/ # Test files
βββ example/ # Usage examples
β βββ csv_example/
β βββ xlsm_example/
βββ pyproject.toml # Modern Python packaging
βββ setup.py # Legacy setup (for compatibility)
βββ README.md # This file
βββ LICENSE # GPL-3.0 license
βββ CONTRIBUTING.md # Contribution guidelines
βββ CODE_OF_CONDUCT.md # Community guidelines
spreadsheet-to-cpplib --file="financial_model.xlsm"This will create a C++ library with:
- Generated header and source files
- CMake configuration
- Mathematical expression support (if enabled)
- Preserved formulas as C++ functions
spreadsheet-to-cpplib --file="data_table.csv"Output includes:
- Structured C++ classes representing your data
- Accessor methods for each column
- Type-safe data handling
- Python 3.8 or higher
- pip or poetry for dependency management
# Clone the repository
git clone https://github.com/shajeen/spreadsheet-to-cpplib.git
cd spreadsheet-to-cpplib
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Format code
black src/
# Type checking
mypy src/# Run all tests
pytest
# Run with coverage
pytest --cov=src/spreadsheet_to_cpplibWe welcome contributions! Please see our Contributing Guidelines for details.
- Open an Issue: Describe your proposed changes or bug report
- Fork & Clone: Fork the repository and clone your fork
- Create Branch: Create a feature branch for your changes
- Make Changes: Implement your changes with tests
- Test: Ensure all tests pass and add new tests as needed
- Submit PR: Create a pull request with a clear description
Please read our Code of Conduct before contributing.
- User Guide: Detailed usage instructions
- API Documentation: Developer reference
- Examples: Sample projects and use cases
- Wiki: Additional documentation and tutorials
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.
- Sheik S Shajeen Ahamed - Creator & Maintainer - @shajeenahamed
See the list of contributors who participated in this project.
- C++ Mathematical Expression Toolkit for formula evaluation support
- OpenPyXL for Excel file processing
- Pandas for data manipulation
- Project Homepage: https://github.com/shajeen/spreadsheet-to-cpplib
- PyPI Package: https://pypi.org/project/spreadsheet-to-cpplib/
- Documentation: Wiki
β If this project helped you, please consider giving it a star on GitHub!