Live data from Hacker News

Excel formulas in JavaScript

github.com

41–50 of 57 posts

Re: Excel formulas in JavaScript

#41
post #9

Any support for i18n? (For English-only speakers: Excel's translation to other languages goes as far as translating function names, thus rendering non-English Excel users' knowledge useless when confronted with an English Excel. E.g., IF(ROUND(A1)=1,B1,C1) in English Excel is JEŻELI(ZAOKR.DO.CAŁK(A1)=1,B1,C1) in Polish Excel -- yes, with all those funky non-ASCII letters.)

Every time I read some comment about how people shouldn't use excel for complex calculations and should use relational databases or Python or whatever else, I'll know why it will never happen. It's really easy to implement the easy parts of spreadsheets, getting the hard parts right is why Excel continues to dominate the space.

Most spreadsheets I've dealt with don't hold relational data. Are there people who use them as such? Sure. But I don't think that's the typical use case.

Re: Excel formulas in JavaScript

#42
post #37
post #36

Earlier quoted context omitted.

That's the reason I always use the English version of everything. What I find most ridiculous is when hotkeys get translated, ex. Ctrl+S is Underline in Spanish (Subrayar)

It never occurred to me that other languages would have different hot-keys. Intuitively it makes sense, but damn I imagine a lot of programs don't do it so it must be a horribly inconsistent experience (I get angry when a program fails to support something like CTRL-W to close windows or CTRL-A for select all or the inconsistency between some using ctrl-shift-Z or ctrl-Y for redo). I guess that's the advantage to the…

oh the worst part is the number formatting. In French, for instance '.' and ',' are reversed. Excel in French then thinks 10,000 is 10. So Value("10,000") is different from Valeur("10,000"). Of course strings do not get translated when changing locale...

Re: Excel formulas in JavaScript

#43
post #33

Earlier quoted context omitted.

Excel only supports numbers that fit in an IEEE754 double, just like JavaScript. There is some fancy logic to format numbers, however (including some mess for date codes). http://oss.sheetjs.com/ssf/ is a pretty decent implementation in JavaScript.

All versions of Excel have native support for integers. http://msdn.microsoft.com/en-us/library/office/bb687869%28v=...

Excel supports 32 bit integers, which fit comfortably in IEEE754 doubles (there are 64 bit integers which cannot be exactly represented)

Re: Excel formulas in JavaScript

#45
post #38

Earlier quoted context omitted.

Every time I read some comment about how people shouldn't use excel for complex calculations and should use relational databases or Python or whatever else, I'll know why it will never happen. It's really easy to implement the easy parts of spreadsheets, getting the hard parts right is why Excel continues to dominate the space.

Ironically, Excel fails miserably at implementing the easy parts of a database. Seriously, how much does doing a simple "Select Distinct" suck in Excel?

So much that I wrote this: http://scpike.com/uniqify/

(I know you can do filter => unique only => copy somewhere) but it's stupidly slow.

Re: Excel formulas in JavaScript

#46
post #23

Very cool! Slightly related... I reckon a command line / ncurses version of Excel would be really useful. Am I crazy? e.g. something like http://upload.wikimedia.org/wikipedia/en/e/ec/Lotus-123-3.0-... Spreadsheets are a pretty useful and powerful tool when it comes to doing ad-hoc data analysis, but it's kind of annoying to get data in and out of them from command line tools.

Just download VisiCalc: http://www.bricklin.com/history/vcexecutable.htm

I have no idea how easy it is to pipe input into and out of it, but it certainly want designed for it.

Re: Excel formulas in JavaScript

#47
post #41

Earlier quoted context omitted.

Every time I read some comment about how people shouldn't use excel for complex calculations and should use relational databases or Python or whatever else, I'll know why it will never happen. It's really easy to implement the easy parts of spreadsheets, getting the hard parts right is why Excel continues to dominate the space.

Most spreadsheets I've dealt with don't hold relational data. Are there people who use them as such? Sure. But I don't think that's the typical use case.

I would say relational data is the dominant use case for spreadsheets. It's a natural fit given the rows and columns. What other kind of data do you see in spreadsheets? Hierarchical data is not a great fit for spreadsheets.

Re: Excel formulas in JavaScript

#48

I honestly admire the thought and effort that went into it. I fear that JavaScript's use of floating point as its single numeric type is likely to create surprising results for the unwary. I have come to the suspicion that the longevity of Excel's dominance is in part due to a sophisticated system for inferring numeric types.

> I have come to the suspicion that the longevity of Excel's dominance is in part due to a sophisticated system for inferring numeric types.

Huh? Doesn't Excel just treat everything computationally as doubles and sometimes display them as integers? As far as "sophisticated systems" for dealing with numeric types go, that's fairly weak sauce (and quite easily doable in JavaScript, which already does the first part).

Re: Excel formulas in JavaScript

#49
post #39
post #11

Earlier quoted context omitted.

Luckily this is a UI thing and the files themself normalize to English. So the project could still be useful for opening Excel files on the web (theoretically).

Oooh, so if I make a spanish excel file and open it in an english excel, the function names are all translated? That's actually pretty neat. Power of storing your equations in a binary format instead of plain text, I guess.

As far as I know it's still text, but the function names are stored in English and are only localised within the Excel UI.

Fun fact: Some old versions of Excel even had a localised VBA ... using ZeichenF instead of String and other oddities made that a very weird experience.

Re: Excel formulas in JavaScript

#50
post #23

Very cool! Slightly related... I reckon a command line / ncurses version of Excel would be really useful. Am I crazy? e.g. something like http://upload.wikimedia.org/wikipedia/en/e/ec/Lotus-123-3.0-... Spreadsheets are a pretty useful and powerful tool when it comes to doing ad-hoc data analysis, but it's kind of annoying to get data in and out of them from command line tools.

Fat-finger errors are already terrifying in spreadsheets. How would you help prevent them in command line tools?
Post reply on HN