Closed dabreegster closed 2 months ago
Thank you for bringing this up. That is a valuable feedback.
We will check it out internally and update this thread.
@dabreegster
INDEX
issue and it seems to work. Unless I misunderstand your point. it('should assume first column if no last argument', () => {
const engine = HyperFormula.buildFromArray([
[1, 2],
[3, 4],
['=INDEX(A1:B2, 2)'],
])
expect(engine.getCellValue(adr('A3'))).toEqual(3)
})
#NUM
for formula =(-2)^5.5
Thanks for confirming! I've been using LibreOffice 7.3 to work with this particular xlsx (I don't have access to Excel on Linux), so maybe the differences are actually there. It was quite a convoluted debugging process to figure out which parts of huge formulas was differing, and it's possible I didn't isolate the root causes properly.
Page URL
https://hyperformula.handsontable.com/guide/compatibility-with-microsoft-excel.html
Improvement description
Hi, I'm using Hyperformula along with https://www.npmjs.com/package/exceljs to automate the use of some Excel models. My script sets input cells, then scrapes some output cells. I started from https://github.com/handsontable/hyperformula-demos/tree/develop/read-excel-file, but to get my particular XLSX working, I wound up with some changes: https://gist.github.com/dabreegster/253ab5f6e489bfbb55584d21fe428081. Along the way, I hit a few confusing differences between HF and Excel:
INDEX(range, 123)
with a 2D range (not just a column or a row), the result is an error. In Excel, seemingly it will default to using the first column or row for the unspecified dimension. So my hack was to use regex on formulas,x.replaceAll(/INDEX\(([^,]+),([^)]+)\)/g, "INDEX($1,1,$2)")
to force row 1, orx.replaceAll(/INDEX\(([^,]+),([^)]+)\)/g, "INDEX($1,$2,1)")
to force column 1.Math.pow(-2, 5.1)
in JS vs=(-2)^5.2
. I manually hacked around this withABS
around the base, but also still preserving the negative for the final result, to match the behavior I was seeing from Excel.mecc2
, which is an illegal name according to HF'sa1CellRefRegexp
. I haven't looked up the Excel spec, just a real-world case I hit._xlfn.IFNA
withIFNA
in formulasI would imagine fixes in HF would need to be gated on new config options. I'm not likely to have time to work on fixes, but I just wanted to report these and the workarounds, in case they're helpful to anyone else. Thanks so much for this great library!