sheetjs icon indicating copy to clipboard operation
sheetjs copied to clipboard

When sheet_to_json() is used, the values of cells calculated by formulas in Excel files cannot be processed.

Open leostar-eva opened this issue 7 years ago • 2 comments

The excel file contains values calculated by formulas, which are lost after processing by sheet_to_json(): const workbook = XLSX.read(data, { type: 'binary' }) const sheetArr =XLSX.utils.sheet_to_json(workbook.Sheets[workbook.SheetName[0]], {header: 1}) console.log('sheetArr: ', sheetArr ) There is no such value in ’sheetArr ‘! Wait anxiously!

leostar-eva avatar Oct 14 '19 02:10 leostar-eva

This is not supported by the free version of xlsx. The sheet doesn't actually contain the values calculated by formulas, it just has the formulas and calculates the values on the fly using the program you use to open it.

I believe the Formula calculator of the Pro Version has what you're looking for.

CloudArchipelago avatar Oct 16 '19 20:10 CloudArchipelago

@CloudArchipelago basically summarized the situation.

XLSX, XLS, and CSV support specifying formula expressions without the actual values. As a CSV example,

1,2,3
=SUM(A1:C1),=A1+B1+C1,=A2+B2

This library can read the underlying values and formulae, but the sheet_to_json helper function only emits the stored values.

One of the components in our Pro version is a calculator that can evaluate formula expressions and update cells and worksheets.

SheetJSDev avatar Oct 17 '19 07:10 SheetJSDev