# ExcelLibrary

**Kind:** Service

**Source:** `Pams/HelperTool/HelperTool.csproj` (line 1)

**Part of:** [Pams](subsystem-pams)

NuGet package dependency

ExcelLibrary is a NuGet package dependency referenced by `Pams/HelperTool/HelperTool.csproj`. HelperTool code uses it to read, create, or update legacy Excel workbook formats as part of its file-processing work.

## Diagram

```mermaid
sequenceDiagram
    participant Caller
    participant HelperTool
    participant ExcelLibrary
    participant Workbook

    Caller->>HelperTool: Request workbook operation
    HelperTool->>ExcelLibrary: Read or write legacy workbook
    ExcelLibrary->>Workbook: Process workbook data
    Workbook-->>ExcelLibrary: Return workbook result
    ExcelLibrary-->>HelperTool: Return processed data
    HelperTool-->>Caller: Return operation result
```

## Usage

```typescript
const response = await fetch("/api/excel/export", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    fileName: "report.xls",
    rows: [
      ["Name", "Status"],
      ["Example", "Complete"],
    ],
  }),
});

if (!response.ok) {
  throw new Error("Excel export failed");
}

const workbook = await response.blob();

const link = document.createElement("a");
link.href = URL.createObjectURL(workbook);
link.download = "report.xls";
link.click();
URL.revokeObjectURL(link.href);
```

## AI Coding Instructions

- Keep ExcelLibrary references in `Pams/HelperTool/HelperTool.csproj`; do not add client-side JavaScript package references for workbook processing.
- Treat this dependency as legacy-format support and verify workbook compatibility before changing file extensions or export behavior.
- Keep workbook reading and writing inside HelperTool code, then expose results through the calling application boundary.
- Handle invalid workbook data and file access failures before returning output to callers.

## Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

### Injected or called by (1)

- `HelperTool` — `Pams/HelperTool/HelperTool.csproj`:1
