pyxll / xlfparser

Header only C++ library for tokenizing Excel formulas

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CMake

xlfparser

Header only C++ library for tokenizing Excel formulas

Modern C++ port of ewbi's Excel formula parser (http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html).

See also https://github.com/lishen2/Excel_formula_parser_cpp, which this code was originally based on.

Some advantages of xlfparser over Excel_formula_parser_cpp are:

  • Implemented in a single header so easier to integrate.
  • Support for wide strings.
  • Doesn't require any 3rd party dependecies (eg. PCRE).
  • Fewer allocations by avoiding string concatenations.

Example Usage

#include <xlfparser.h>
#include <iostream>

int main()
{
    std::string formula("=SUM(1,2,3)");
    auto tokens = xlfparser::tokenize(formula);
    
    for (const auto& token: tokens)
        std::cout << token.value(formula) << std::end;
        
    return 0;
}

See also example.cpp.

About

Header only C++ library for tokenizing Excel formulas

License:MIT License


Languages

Language:C++ 94.6%Language:Python 4.3%Language:Cython 1.0%Language:CMake 0.1%