Skip to content

Latest commit

Β 

History

51 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Spreadsheet to C++ Library

CI PyPI version Python 3.9+ License: GPL v3

Convert spreadsheets (XLSM, CSV) into CMake-ready C++ library projects with mathematical expression support. Published on PyPI.

✨ Features

  • 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

πŸš€ Quick Start

Installation

Install from PyPI (recommended):

pip install spreadsheet-to-cpplib

Install from source:

pip install git+https://github.com/shajeen/spreadsheet-to-cpplib.git

Basic Usage

# 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.

πŸ“‹ Configuration Options

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

πŸ“ Project Structure

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

πŸ“– Examples

Excel (XLSM) Example

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

CSV Example

spreadsheet-to-cpplib --file="data_table.csv"

Output includes:

  • Structured C++ classes representing your data
  • Accessor methods for each column
  • Type-safe data handling

πŸ”§ Development

Prerequisites

  • Python 3.8 or higher
  • pip or poetry for dependency management

Setting up Development Environment

# 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/

Running Tests

# Run all tests
pytest

# Run with coverage
pytest --cov=src/spreadsheet_to_cpplib

🀝 Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Quick Contribution Steps

  1. Open an Issue: Describe your proposed changes or bug report
  2. Fork & Clone: Fork the repository and clone your fork
  3. Create Branch: Create a feature branch for your changes
  4. Make Changes: Implement your changes with tests
  5. Test: Ensure all tests pass and add new tests as needed
  6. Submit PR: Create a pull request with a clear description

Please read our Code of Conduct before contributing.

πŸ“š Documentation

πŸ› Bug Reports & Feature Requests

πŸ“„ License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

πŸ‘₯ Authors & Contributors

See the list of contributors who participated in this project.

πŸ™ Acknowledgments

πŸ”— Links


⭐ If this project helped you, please consider giving it a star on GitHub!

About

Convert spreadsheets (XLSM, CSV) into CMake-ready C++ library projects with mathematical expression support. Published on PyPI.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages