@bilig/sheetjs-formula-recalc 0.38.1 → 0.38.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +97 -2
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -2,16 +2,111 @@
2
2
 
3
3
  Scoped SheetJS formula recalculation package for Node.js without Excel, LibreOffice, or browser automation.
4
4
 
5
+ Use this package when the rest of your pipeline already uses SheetJS or the
6
+ `xlsx` package for workbook file I/O, but a backend job needs fresh formula
7
+ readback after changing inputs.
8
+
9
+ The unscoped `sheetjs-formula-recalc` package remains published as a
10
+ compatibility and search alias.
11
+
12
+ ## If You Arrived From a SheetJS Formula Issue
13
+
14
+ SheetJS is good at reading and writing spreadsheet files. The common production
15
+ gap is different:
16
+
17
+ - `SheetJS formula result not updating`
18
+ - `xlsx formula value stale after edit`
19
+ - `js-xlsx recalculate formulas`
20
+ - `refresh formula cells in xlsx node`
21
+
22
+ Formula cells can carry cached results. When a Node process edits `Inputs!B2`,
23
+ the cached value in `Summary!B7` is not automatically recalculated inside that
24
+ process.
25
+
26
+ Use this package at the file boundary:
27
+
28
+ 1. let SheetJS produce or update XLSX bytes;
29
+ 2. call `recalculateSheetjsWorkbook(...)`;
30
+ 3. read proof cells from `result.reads`;
31
+ 4. write `result.xlsx` if the updated artifact is needed.
32
+
33
+ This package is a SheetJS-named bridge over `@bilig/xlsx-formula-recalc`, so
34
+ teams searching for a SheetJS answer can find the right boundary directly.
35
+
36
+ ## Install
37
+
5
38
  ```sh
6
39
  npm install @bilig/sheetjs-formula-recalc
40
+ ```
41
+
42
+ ## CLI
43
+
44
+ Run a self-contained proof first:
45
+
46
+ ```sh
7
47
  npx --package @bilig/sheetjs-formula-recalc sheetjs-recalc --demo --json
8
48
  ```
9
49
 
50
+ For a real workbook:
51
+
52
+ ```sh
53
+ npx --package @bilig/sheetjs-formula-recalc sheetjs-recalc quote.xlsx \
54
+ --set Inputs!B2=48 \
55
+ --set Inputs!B3=1500 \
56
+ --read Summary!B7 \
57
+ --out quote.recalculated.xlsx \
58
+ --json
59
+ ```
60
+
61
+ The command writes the recalculated XLSX and prints the requested read cells.
62
+
63
+ ## TypeScript
64
+
10
65
  ```ts
66
+ import { readFile, writeFile } from 'node:fs/promises'
11
67
  import { recalculateSheetjsWorkbook } from '@bilig/sheetjs-formula-recalc'
68
+
69
+ const result = recalculateSheetjsWorkbook(await readFile('quote.xlsx'), {
70
+ fileName: 'quote.xlsx',
71
+ edits: [
72
+ { target: 'Inputs!B2', value: 48 },
73
+ { target: 'Inputs!B3', value: 1500 },
74
+ ],
75
+ reads: ['Summary!B7'],
76
+ })
77
+
78
+ await writeFile('quote.recalculated.xlsx', result.xlsx)
79
+
80
+ console.log({
81
+ value: result.reads['Summary!B7'],
82
+ warnings: result.warnings,
83
+ })
12
84
  ```
13
85
 
14
- The unscoped `sheetjs-formula-recalc` package remains published as a compatibility
15
- and search alias.
86
+ ## Proof Against SheetJS, xlsx-populate, and ExcelJS
87
+
88
+ The repository includes a cross-library proof:
89
+
90
+ ```sh
91
+ git clone https://github.com/proompteng/bilig.git
92
+ cd bilig
93
+ npm --prefix examples/recalc-bridge-workflows install
94
+ npm --prefix examples/recalc-bridge-workflows run smoke
95
+ ```
96
+
97
+ It edits the same workbook through SheetJS/`xlsx`, `xlsx-populate`, and
98
+ ExcelJS, then verifies that Bilig refreshes the stale `48000` result to
99
+ `72000`.
100
+
101
+ ## What This Is Not
102
+
103
+ This is not a full Excel clone and not a replacement for SheetJS file I/O. Keep
104
+ SheetJS where it is strongest: parsing, writing, and transforming workbook
105
+ files. Add this package only where the Node process must own recalculated
106
+ formula readback before accepting, rejecting, returning, or persisting a
107
+ workflow.
108
+
109
+ Review `result.warnings` and keep fixtures for unsupported functions, external
110
+ workbook links, macros, volatile functions, and customer-critical templates.
16
111
 
17
112
  Full docs: <https://proompteng.github.io/bilig/sheetjs-formula-result-not-updating-node.html>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bilig/sheetjs-formula-recalc",
3
- "version": "0.38.1",
3
+ "version": "0.38.3",
4
4
  "description": "Scoped SheetJS formula recalculation package for Node.js without Excel, LibreOffice, or browser automation.",
5
5
  "keywords": [
6
6
  "bilig",
@@ -55,8 +55,8 @@
55
55
  "smoke": "node ./dist/cli.js --help"
56
56
  },
57
57
  "dependencies": {
58
- "@bilig/xlsx-formula-recalc": "0.38.1",
59
- "sheetjs-formula-recalc": "0.38.1"
58
+ "@bilig/xlsx-formula-recalc": "0.38.3",
59
+ "sheetjs-formula-recalc": "0.38.3"
60
60
  },
61
61
  "engines": {
62
62
  "node": ">=22.0.0"