top | item 40459232

(no title)

rfergie | 1 year ago

https://pypi.org/project/formulas/ might help with this without needing the OpenAI part

discuss

order

narush|1 year ago

Thanks for the link! We looked into existing libraries for Excel formula execution - this library as an awesome example!

We considered using this, but to copy from our MVP spec:

The easiest thing to do is to replicate Excel’s execution engine — you can see someone who has done this [here](https://pypi.org/project/xlcalculator/). But this is just evaluating Excel formulas is not what users want when transitioning a process to Excel - they want to be able to ditch Excel (mostly).

The next easiest thing would be to transpile Excel formulas to the following format:

    # This is not a useful or usable artifact; you're still trapped in Excel
    # but things are just worse now, since it's not on a 2d grid
    A1 = "Prices"
    A2 = 1
    A3 = 2
    B1 = "With Tax"
    B2 = SUM(A1, 10) * 1.3
    B3 = SUM(A2, 10) * 1.3
But this is ultimately is an awful solution for the user:

1. It’s 100% impossible to read. A large Excel file often has 100k+ formulas (many of them with shared structures). This is 100k+ lines of code...

2. It’s impossible to maintain. Yeah, since it lacks all semantic structure, there’s no f** way you’re going to test it or modify it.

In general: *we're trying to generate a Python script that appears to be written by an expert developer. To do this, you have to be willing to ditch the Excel formulas / execution engine.