{"_id":"@devath/angular-excel-tools","_rev":"3-e9060683ffbca144a490f8710cdf1dbb","name":"@devath/angular-excel-tools","dist-tags":{"latest":"0.1.6"},"versions":{"0.1.2":{"name":"@devath/angular-excel-tools","version":"0.1.2","author":{"name":"You"},"license":"MIT","_id":"@devath/angular-excel-tools@0.1.2","maintainers":[{"name":"devath","email":"luccky249@gmail.com"}],"dist":{"shasum":"3b2194cbaf60caa844d7da8bfb948886f85fbb4b","tarball":"https://registry.npmjs.org/@devath/angular-excel-tools/-/angular-excel-tools-0.1.2.tgz","fileCount":14,"integrity":"sha512-MyeOiaH9FrMKLWEp8HH+/0MtwuA6LFRgDZh5wEdKXweZNpIUOC6QjWxGcvi7gTdgDnMqzmsWC7diov7zsSRSQg==","signatures":[{"sig":"MEUCIQCHUbxdWMVxV5HlrI8PtCcSepluULtbf5dLGeKPgHI0/QIgQ/NDT1/5BJF4tuJOuh8WdjvD2Ozfp7lBzEYg/BuOqiI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10490},"gitHead":"f3685b96147485fa2d164b143a2d29552f59e76a","_npmUser":{"name":"devath","email":"luccky249@gmail.com"},"_npmVersion":"10.8.1","description":"XLSX (SheetJS) utilities for Angular + helpers for Angular Material Table","directories":{},"sideEffects":false,"_nodeVersion":"20.16.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"xlsx":"^0.18.5","@angular/core":"^18.0.0","@angular/common":"^18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/angular-excel-tools_0.1.2_1758048249057_0.5520364925444137","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@devath/angular-excel-tools","version":"0.1.5","keywords":["angular","excel","xlsx","sheetjs","spreadsheet","import","export","aoa","material","mat-table","datatable","table"],"author":{"name":"Sandesh Ath"},"license":"MIT","_id":"@devath/angular-excel-tools@0.1.5","maintainers":[{"name":"devath","email":"luccky249@gmail.com"}],"homepage":"https://github.com/sandeshATH/npm-excel-tools-ws#readme","bugs":{"url":"https://github.com/sandeshATH/npm-excel-tools-ws/issues"},"dist":{"shasum":"ce6cbdb8b99d1016db05c5474da27174775d5c49","tarball":"https://registry.npmjs.org/@devath/angular-excel-tools/-/angular-excel-tools-0.1.5.tgz","fileCount":17,"integrity":"sha512-G3xedWACyEcGD+W0QBU/60WHMGGGa2Ein5xjoLGpmcQ8ZTWRhHxt4sOlQFcTeC4TGw6xpl09BU72MGtdy5t//w==","signatures":[{"sig":"MEYCIQDeoZpAekYE2FA1ncJrLbyjXmF82r4rBUs8WpHnXSjShQIhAJF5NpWzGj5tmEQY8gr3/YmuKiFnGJxTdOYGy4GsnO2l","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40080},"module":"fesm2022/devath-angular-excel-tools.mjs","exports":{".":{"esm":"./esm2022/devath-angular-excel-tools.mjs","types":"./index.d.ts","default":"./fesm2022/devath-angular-excel-tools.mjs","esm2022":"./esm2022/devath-angular-excel-tools.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"662d714b89fe9fc3d9ad6a6c47d10fbc4b9b965c","typings":"index.d.ts","_npmUser":{"name":"devath","email":"luccky249@gmail.com"},"repository":{"url":"git+https://github.com/sandeshATH/npm-excel-tools-ws.git","type":"git","directory":"projects/excel-tools"},"_npmVersion":"10.2.4","description":"XLSX (SheetJS) utilities for Angular + helpers for Angular Material Table","directories":{},"sideEffects":false,"_nodeVersion":"20.11.1","dependencies":{"tslib":"^2.3.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"peerDependencies":{"xlsx":"^0.18.5","@angular/core":"^18.0.0","@angular/common":"^18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/angular-excel-tools_0.1.5_1767617907273_0.6924047914473863","host":"s3://npm-registry-packages-npm-production"}},"0.1.6":{"name":"@devath/angular-excel-tools","version":"0.1.6","description":"XLSX (SheetJS) utilities for Angular + helpers for Angular Material Table","license":"MIT","author":{"name":"Sandesh Ath"},"sideEffects":false,"keywords":["angular","excel","xlsx","sheetjs","spreadsheet","import","export","aoa","material","mat-table","datatable","table"],"repository":{"type":"git","url":"git+https://github.com/sandeshATH/npm-excel-tools-ws.git","directory":"projects/excel-tools"},"bugs":{"url":"https://github.com/sandeshATH/npm-excel-tools-ws/issues"},"homepage":"https://github.com/sandeshATH/npm-excel-tools-ws#readme","publishConfig":{"access":"public"},"peerDependencies":{"@angular/common":"^18.0.0","@angular/core":"^18.0.0","xlsx":"^0.18.5"},"module":"fesm2022/devath-angular-excel-tools.mjs","typings":"index.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./index.d.ts","esm2022":"./esm2022/devath-angular-excel-tools.mjs","esm":"./esm2022/devath-angular-excel-tools.mjs","default":"./fesm2022/devath-angular-excel-tools.mjs"}},"dependencies":{"tslib":"^2.3.0"},"_id":"@devath/angular-excel-tools@0.1.6","gitHead":"662d714b89fe9fc3d9ad6a6c47d10fbc4b9b965c","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-/5L15A0AFq0naaAFJKOO+loeG6l0FXoCxN7PeTRRSRUC8v5SD9CYrizhQP5/RJ2rCbPNCGn3RAfeBlnqMbX2Gg==","shasum":"32dd08a5e43fd222bd58191647698b16ee1e532f","tarball":"https://registry.npmjs.org/@devath/angular-excel-tools/-/angular-excel-tools-0.1.6.tgz","fileCount":17,"unpackedSize":40438,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICeTzVPKtbJI9XhQbuQleOnmd1tIUWFlwpt/0yDLGd4OAiEAqsD/Vtfp7QWEUhrSR26U2XnW7x1Mgvm3mwakZMdbiYc="}]},"_npmUser":{"name":"devath","email":"luccky249@gmail.com"},"directories":{},"maintainers":[{"name":"devath","email":"luccky249@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/angular-excel-tools_0.1.6_1767618225376_0.18260380443738145"},"_hasShrinkwrap":false}},"time":{"created":"2025-09-16T18:44:08.945Z","modified":"2026-01-05T13:03:45.764Z","0.1.2":"2025-09-16T18:44:09.252Z","0.1.5":"2026-01-05T12:58:27.411Z","0.1.6":"2026-01-05T13:03:45.564Z"},"bugs":{"url":"https://github.com/sandeshATH/npm-excel-tools-ws/issues"},"author":{"name":"Sandesh Ath"},"license":"MIT","homepage":"https://github.com/sandeshATH/npm-excel-tools-ws#readme","keywords":["angular","excel","xlsx","sheetjs","spreadsheet","import","export","aoa","material","mat-table","datatable","table"],"repository":{"type":"git","url":"git+https://github.com/sandeshATH/npm-excel-tools-ws.git","directory":"projects/excel-tools"},"description":"XLSX (SheetJS) utilities for Angular + helpers for Angular Material Table","maintainers":[{"name":"devath","email":"luccky249@gmail.com"}],"readme":"# @devath/angular-excel-tools\n\n[![npm](https://img.shields.io/npm/v/@devath/angular-excel-tools)](https://www.npmjs.com/package/@devath/angular-excel-tools)\n[![downloads](https://img.shields.io/npm/dw/@devath/angular-excel-tools)](https://www.npmjs.com/package/@devath/angular-excel-tools)\n\nXLSX (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.\n\n## Why this package\n\n- Minimal API: read, sanitize, align headers, export.\n- AOA-first: easy to map to your own models.\n- MatTable helpers: import/export with table-friendly shapes.\n\n## Live demo\n\n- StackBlitz template: https://stackblitz.com/fork/angular\n- After it opens, run: `npm i @devath/angular-excel-tools xlsx`\n- Paste the Quick start example below into `app.component.ts`\n\n## Install\n\n```bash\nnpm i @devath/angular-excel-tools xlsx\n```\n\nPeer dependencies: `@angular/common@^18`, `@angular/core@^18`, `xlsx@^0.18.5`.\n\n## Quick start\n\nImport and use the `ExcelService` in any component or service.\n\n```ts\n// example.component.ts\nimport { Component } from '@angular/core';\nimport { ExcelService, ImportResult } from '@devath/angular-excel-tools';\n\n@Component({\n  selector: 'app-example',\n  template: `\n    <input type=\"file\" accept=\".xlsx,.xls\" (change)=\"onFile($event)\" />\n    <button (click)=\"exportSample()\">Export sample</button>\n  `\n})\nexport class ExampleComponent {\n  constructor(private excel: ExcelService) {}\n\n  async onFile(ev: Event) {\n    const input = ev.target as HTMLInputElement;\n    const file = input.files?.[0];\n    if (!file) return;\n    const result: ImportResult = await this.excel.readFile(file);\n    console.log(result.sheetNames); // [\"Sheet1\", ...]\n    console.log(result.sheets[\"Sheet1\"]); // AOA data\n  }\n\n  exportSample() {\n    const aoa = [\n      ['Name', 'Age'],\n      ['Alice', 30],\n      ['Bob', 28]\n    ];\n    this.excel.exportToXlsx({ data: aoa, filename: 'people.xlsx' });\n  }\n}\n```\n\nYou can also export multiple sheets by passing an object of sheet names to AOA data:\n\n```ts\nthis.excel.exportToXlsx({\n  data: {\n    Summary: [['Metric', 'Value'], ['Count', 2]],\n    People:  [['Name', 'Age'], ['Alice', 30], ['Bob', 28]]\n  },\n  filename: 'report.xlsx'\n});\n```\n\n## Angular Material helpers\n\nHelpers convert AOA ↔ MatTable-friendly shapes.\n\n```ts\nimport { aoaToMatTable, matTableToAoa } from '@devath/angular-excel-tools';\n\nconst { displayedColumns, rows } = aoaToMatTable(aoa);\n// bind: <table mat-table [dataSource]=\"rows\"> ...\n\nconst aoaOut = matTableToAoa(displayedColumns, rows);\n```\n\n## Use cases\n\n- Import user-provided spreadsheets into your app.\n- Export table data to Excel for reporting.\n- Normalize messy sheets with header alignment.\n\n## API\n\n- ExcelService.readFile(file): Promise<ImportResult>\n  - Reads an Excel file and returns `{ sheetNames: string[], sheets: Record<string, AOA> }`.\n- ExcelService.exportToXlsx({ data, filename })\n  - `data`: `AOA` for a single sheet or `Record<string, AOA>` for multiple sheets.\n  - `filename`: optional, defaults to `export.xlsx`.\n- ExcelService.sanitizeAOA(aoa)\n  - Normalizes rows to the same length, trims strings, replaces `undefined` with `null`.\n- ExcelService.alignHeaders(aoa, headers)\n  - Reorders columns of imported data to match your desired header order.\n- aoaToMatTable(aoa)\n  - Converts AOA (first row is headers) to `{ displayedColumns, rows }`.\n- matTableToAoa(displayedColumns, rows)\n  - Converts MatTable inputs to AOA.\n\nTypes:\n- AOA: `(string | number | boolean | null | undefined)[][]`\n- ImportResult: `{ sheetNames: string[]; sheets: Record<string, AOA>; }`\n\n## Tips\n\n- Use `sanitizeAOA` right after import to ensure consistent row lengths.\n- Use `alignHeaders` to map user-provided sheets to your required schema.\n\n## Angular compatibility\n\n- Built with Angular 18 and Ivy partial compilation. Should work in Angular 16+ projects using Ivy.\n\n## License\n\nMIT © Sandesh Ath\n","readmeFilename":"README.md"}