exceljs / exceljs/exceljs

Append rows to existing table

Open
#1,062 15 comments 11 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
15.5k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

Hello, I'm having an issue when appending new rows to existing table

```javascript
const workbook = new ExcelJS.Workbook()
workbook.xlsx.readFile(filename).then(async function () {
let worksheet = workbook.getWorksheet(1)
let table = worksheet.getTable('MyTable')
table.addRow(['One','Two'])
table.commit()
await workbook.xlsx.writeFile(filename)
})
```
I'm getting this error :

```
TypeError: Cannot read property 'length' of undefined
at Table.get height [as height] (C:\Users\SatSuki\Desktop\FootScrap\node_modules\exceljs\lib\doc\table.js:88:32)
at Table.get filterHeight [as filterHeight] (C:\Users\SatSuki\Desktop\FootScrap\node_modules\exceljs\lib\doc\table.js:93:21)
at Table.get tableHeight [as tableHeight] (C:\Users\SatSuki\Desktop\FootScrap\node_modules\exceljs\lib\doc\table.js:98:21)
at Table.cacheState (C:\Users\SatSuki\Desktop\FootScrap\node_modules\exceljs\lib\doc\table.js:272:35)
at Table.addRow (C:\Users\SatSuki\Desktop\FootScrap\node_modules\exceljs\lib\doc\table.js:322:14)
at C:\Users\SatSuki\Desktop\FootScrap\spread.js:62:27
at process._tickCallback (internal/process/next_tick.js:68:7)
```
When appending just after creating the table it works fine.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.