You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Upstream status:** PR exists ([#2885](https://github.com/exceljs/exceljs/pull/2885)), adopted here
164
172
165
-
### 3. Enhanced Bug Fixes
173
+
### 3. Table addRow() Fix for Templates
174
+
175
+
**Why it matters:** Loading Excel files with tables and adding rows to them crashes in official exceljs. This is critical for template-based workflows.
176
+
177
+
**Code:**
178
+
```javascript
179
+
// ✅ Works in @protobi/exceljs
180
+
// ❌ Crashes in official exceljs with "Cannot read properties of undefined (reading 'length')"
181
+
182
+
constworkbook=newExcel.Workbook();
183
+
awaitworkbook.xlsx.readFile('template.xlsx');
184
+
185
+
constworksheet=workbook.getWorksheet('Data');
186
+
consttable=worksheet.getTable('MyTable');
187
+
188
+
// Add rows to the loaded table
189
+
table.addRow(['New', 'Data', 'Here']); // Works!
190
+
table.addRow(['More', 'Data', 'Here']); // Works!
191
+
192
+
awaitworkbook.xlsx.writeFile('output.xlsx');
193
+
```
194
+
195
+
**What it fixes:**
196
+
- "Cannot read properties of undefined (reading 'length')" error
197
+
- Missing worksheet references in loaded tables
198
+
- Table references not expanding dynamically when rows are added
0 commit comments