News for hackers. Stuff that matters.
Re:Show HN: Publisheet – Publish Excel sheets as interactive... by cm2187 on Wednesday September 18, 2019 @01:21PM (#21007642)
Are all these using a full excel calculation engine behind (like SpreadsheetGear or else)?

I always thought that if I had lots of spare time, a good project would be to take a spreadsheet, specify the input cells and output cells, analyse the logic of the formulas in between, and generate automatically some code that replicates this calculation and can be compiled.

That way you can preserve the logic in excel so a business user can own it, while getting all the performance and scalability of compiled code.

Re:Show HN: Publisheet – Publish Excel sheets as interactive... by sheetjs on Wednesday September 18, 2019 @01:58PM (#21008088)
Shameless plug: we (https://sheetjs.com/) offer that as one of our paid builds. In conjunction with our JS parser https://github.com/SheetJS/js-xlsx , you can modify cell values / formulae and recalculate the workbook (or individual expressions) in the web browser or nodejs
Re:Show HN: Publisheet – Publish Excel sheets as interactive... by davidpolberger on Wednesday September 18, 2019 @04:36PM (#21009862)
The Calculoid people have publicly disclosed (https://github.com/calculoidapp/calculoidapp.github.io/wiki/...) they they're using this library for evaluating formulas:

https://silentmatt.com/javascript-expression-evaluator/

Through that library, they support a limited number of functions, which map more closely to the built-in Math object of JavaScript than to Excel.

We (Calcapp) have a custom-written compiler, which our server uses as a library for checking formulas and producing JavaScript code. In 2016, we changed our formula syntax to be largely compatible with what Excel and other spreadsheets use (https://www.calcapp.net/blog/2016/06/02/formula-syntax.html).

We support 281 formula functions, most of them compatible with what spreadsheets offer (https://www.calcapp.net/learn/functions.html). We have around a thousand unit tests verifying that we get the same results as Excel.

Thanks to our extensive function library, importing spreadsheets is often straight-forward (https://www.calcapp.net/blog/2017/06/14/convert.html). (We don't do a good job of supporting table look-ups, though, and we will soon turn our focus towards solving that problem.)

Our function library is released under the MIT license and is available on GitHub:

https://github.com/davidpolberger/formulajs

It is a fork of an existing library (formulajs) and includes a fair number of bug fixes and improvements.

At runtime, apps make use of a dependency graph generated by the compiler to ensure that calculations aren't run needlessly. As far as I'm aware, this is the same technique used by all spreadsheets.

It would be straightforward to analyze a workbook and build a dependency graph to determine inputs and outputs. From there, an app could be generated. The only issue is inferring the user interface -- labels often appear to the left of the input and output cells, and while this could be used as a heuristic, it wouldn't be perfect. I've toyed with the idea of using machine learning to do a better job of inferring a user interface.