XLSX (SheetJS) utilities for Angular + helpers for Angular Material Table
npm install @devath/angular-excel-tools

XLSX (SheetJS) utilities for Angular apps. Provides a simple ExcelService to import .xlsx files into arrays-of-arrays (AOA) and export data back to Excel. Includes helpers for Angular Material tables. Designed to work with Angular 18.
- Minimal API: read, sanitize, align headers, export.
- AOA-first: easy to map to your own models.
- MatTable helpers: import/export with table-friendly shapes.
- StackBlitz template: https://stackblitz.com/fork/angular
- After it opens, run: npm i @devath/angular-excel-tools xlsx
- Paste the Quick start example below into app.component.ts
``bash`
npm i @devath/angular-excel-tools xlsx
Peer dependencies: @angular/common@^18, @angular/core@^18, xlsx@^0.18.5.
Import and use the ExcelService in any component or service.
`ts
// example.component.ts
import { Component } from '@angular/core';
import { ExcelService, ImportResult } from '@devath/angular-excel-tools';
@Component({
selector: 'app-example',
template:
})
export class ExampleComponent {
constructor(private excel: ExcelService) {}
async onFile(ev: Event) {
const input = ev.target as HTMLInputElement;
const file = input.files?.[0];
if (!file) return;
const result: ImportResult = await this.excel.readFile(file);
console.log(result.sheetNames); // ["Sheet1", ...]
console.log(result.sheets["Sheet1"]); // AOA data
}
exportSample() {
const aoa = [
['Name', 'Age'],
['Alice', 30],
['Bob', 28]
];
this.excel.exportToXlsx({ data: aoa, filename: 'people.xlsx' });
}
}
`
You can also export multiple sheets by passing an object of sheet names to AOA data:
`ts`
this.excel.exportToXlsx({
data: {
Summary: [['Metric', 'Value'], ['Count', 2]],
People: [['Name', 'Age'], ['Alice', 30], ['Bob', 28]]
},
filename: 'report.xlsx'
});
Helpers convert AOA ↔ MatTable-friendly shapes.
`ts
import { aoaToMatTable, matTableToAoa } from '@devath/angular-excel-tools';
const { displayedColumns, rows } = aoaToMatTable(aoa);
// bind: