exceljs / exceljs/exceljs

Adding Rows to Table

Open
#2,124 2 comments 6 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.5k
Forks
2k
PR merge metrics
No merged PRs in 30d

Description

I can't seem to add rows to an existing table. For example, I have an existing workbook named 'test.xlsx', an existing sheet named 'Sheet 1' and an existing Table in that sheet named 'JDB'. The library seems to read everything fine but when I try the addRow method on the Table I get an error: "return this.table.rows.length -- TypeError: Cannot read property 'length' of undefined"

Sample code that is causing error:

```
const addRows = async () => {
const workbook = new ExcelJS.Workbook();
await workbook.xlsx.readFile('test.xlsx');
const sheet = workbook.getWorksheet('Sheet 1');
const table = sheet.getTable('JDB');

table.addRow([8,9,0,'End']);
table.commit();

await workbook.xlsx.writeFile('test.xlsx');
}
```

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.