Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gershnik/spreader
A fast, portable spreadsheet logic library
https://github.com/gershnik/spreader
cplusplus cpp cpp20 spreadsheet spreadsheet-data spreadsheet-manipulation
Last synced: 8 days ago
JSON representation
A fast, portable spreadsheet logic library
- Host: GitHub
- URL: https://github.com/gershnik/spreader
- Owner: gershnik
- License: bsd-3-clause
- Created: 2023-03-24T11:22:28.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-08-04T01:56:15.000Z (over 1 year ago)
- Last Synced: 2024-11-09T01:54:22.543Z (2 months ago)
- Topics: cplusplus, cpp, cpp20, spreadsheet, spreadsheet-data, spreadsheet-manipulation
- Language: C++
- Homepage:
- Size: 323 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Spreader
A fast, portable spreadsheet logic library
[![Language](https://img.shields.io/badge/language-C++-blue.svg)](https://isocpp.org/)
[![Standard](https://img.shields.io/badge/C%2B%2B-20-blue.svg)](https://en.wikipedia.org/wiki/C%2B%2B#Standardization)
[![License](https://img.shields.io/badge/license-BSD-brightgreen.svg)](https://opensource.org/licenses/BSD-3-Clause)Spreader is a portable C++ library that implements spreadsheet logic - reading and writing data and formulas into cells, automatic recalculation, copying and moving cells, adding and deleting rows and columns and so on. It does not implement any spreadsheet UI,
though the hope is that eventually it will be possible to write a UI based on it.
It is currently in alpha stage.Wrapper libraries in JavaScript and Python are available at [spreader.js](https://github.com/gershnik/spreader.js) and
[spreader.py](https://github.com/gershnik/spreader.py) respectively.## Build
You will need CMake 3.24 or better as well as C++ compiler that supports C++20. The following compilers are known to work
- GCC 11.3 or above
- Xcode 14 or above
- Visual Studio 2022 or aboveTo get the library as a dependency:
```cmake
include(FetchContent)
FetchContent_Declare(spreader
GIT_REPOSITORY [email protected]:gershnik/spreader.git
GIT_TAG
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(spreader)
```If you have Bison 3.8 or better and/or Flex 2.6 or better available on your machine CMake build will use them to generate code
for formula parser. Otherwise it will use pre-built files.## Quick start
```cpp
#include
using namespace Spreader;
//Create a new sheet
auto sheet = Sheet();
//Set A2 cell to contain plain value.
sheet.setValueCell(Point{.x=0, .y=1}, "Hello ");
//You can also use regular cell notation.
//The result of parsePoint is std::optional
sheet.setValueCell(sheet.parsePoint("B3").value(), "World!");
//Set a cell to contain formula
sheet.setFormulaCell(Point{.x=0, .y=0}, "A2 & B3");
//Read calculated formula result
auto val = s.getValue(Point{.x=0, .y=0});
//prints "Hello Wolrd!"
std::cout << val;
```