npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@devath/angular-excel-tools

v0.1.6

Published

XLSX (SheetJS) utilities for Angular + helpers for Angular Material Table

Readme

@devath/angular-excel-tools

npm downloads

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.

Why this package

  • Minimal API: read, sanitize, align headers, export.
  • AOA-first: easy to map to your own models.
  • MatTable helpers: import/export with table-friendly shapes.

Live demo

  • 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

Install

npm i @devath/angular-excel-tools xlsx

Peer dependencies: @angular/common@^18, @angular/core@^18, xlsx@^0.18.5.

Quick start

Import and use the ExcelService in any component or service.

// example.component.ts
import { Component } from '@angular/core';
import { ExcelService, ImportResult } from '@devath/angular-excel-tools';

@Component({
  selector: 'app-example',
  template: `
    <input type="file" accept=".xlsx,.xls" (change)="onFile($event)" />
    <button (click)="exportSample()">Export sample</button>
  `
})
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:

this.excel.exportToXlsx({
  data: {
    Summary: [['Metric', 'Value'], ['Count', 2]],
    People:  [['Name', 'Age'], ['Alice', 30], ['Bob', 28]]
  },
  filename: 'report.xlsx'
});

Angular Material helpers

Helpers convert AOA ↔ MatTable-friendly shapes.

import { aoaToMatTable, matTableToAoa } from '@devath/angular-excel-tools';

const { displayedColumns, rows } = aoaToMatTable(aoa);
// bind: <table mat-table [dataSource]="rows"> ...

const aoaOut = matTableToAoa(displayedColumns, rows);

Use cases

  • Import user-provided spreadsheets into your app.
  • Export table data to Excel for reporting.
  • Normalize messy sheets with header alignment.

API

  • ExcelService.readFile(file): Promise
    • Reads an Excel file and returns { sheetNames: string[], sheets: Record<string, AOA> }.
  • ExcelService.exportToXlsx({ data, filename })
    • data: AOA for a single sheet or Record<string, AOA> for multiple sheets.
    • filename: optional, defaults to export.xlsx.
  • ExcelService.sanitizeAOA(aoa)
    • Normalizes rows to the same length, trims strings, replaces undefined with null.
  • ExcelService.alignHeaders(aoa, headers)
    • Reorders columns of imported data to match your desired header order.
  • aoaToMatTable(aoa)
    • Converts AOA (first row is headers) to { displayedColumns, rows }.
  • matTableToAoa(displayedColumns, rows)
    • Converts MatTable inputs to AOA.

Types:

  • AOA: (string | number | boolean | null | undefined)[][]
  • ImportResult: { sheetNames: string[]; sheets: Record<string, AOA>; }

Tips

  • Use sanitizeAOA right after import to ensure consistent row lengths.
  • Use alignHeaders to map user-provided sheets to your required schema.

Angular compatibility

  • Built with Angular 18 and Ivy partial compilation. Should work in Angular 16+ projects using Ivy.

License

MIT © Sandesh Ath