formula 0.0.1

A parser and evaluator of spreadsheet-like formulas
Documentation

Crates.io Workflow Status

It's in its early stages, and we are trying to add more functions and features soon.

So far we have the following features:

  • 18 date time functions
  • 26 text functions

Installation and usage

Add this library to your project with cargo add formula or add formula = "*" to your Cargo.toml file.

Use it similar to the following code:

use formula::{Formula, Expr, error::Error};
use anyhow::Result;

fn main() -> Result<()> {
    let formula = Formula::new("UPPER(TRIM('   Hello '))")?;
    let value = formula.parse().unwrap();
    assert_eq!(value, Expr::String("HELLO".to_string()));
    Ok(())
}

What we do not support:

  • We would like to add more functions, like Excel functions, Google Sheets functions, and more
  • At the moment, we don't support table data, so you need to pass values to the formula as arguments by yourself
  • We do not support simple formulas like 1+1 or as argument like AND(1>3, 1<3) or SUM(2-1, 2), yet

Contributing

We would love to have your contribution! Please read our contributing guidelines to get started.

License

This project is licensed under the MIT license. See the LICENSE file for more info.