@@ -10,7 +10,80 @@ A package for parsing and generating Excel files for NHS Notify supplier configu
1010
1111## Usage
1212
13- ### Parsing an Excel file
13+ ### CLI Commands
14+
15+ #### Parse Excel to JSON
16+
17+ Parse an Excel file and output the parsed JSON data:
18+
19+ ``` bash
20+ # Parse and output to stdout
21+ npm run parse -- config.xlsx
22+
23+ # Parse and pretty-print to stdout
24+ npm run parse -- config.xlsx --pretty
25+
26+ # Parse and save to file
27+ npm run parse -- config.xlsx -o output.json
28+
29+ # Parse with pretty formatting and save to file
30+ npm run parse -- config.xlsx --pretty --output output.json
31+
32+ # Show help
33+ npm run parse -- --help
34+ ```
35+
36+ ** Options:**
37+
38+ - ` -o, --output <file> ` - Write output to a file instead of stdout
39+ - ` -p, --pretty ` - Pretty-print the JSON output
40+ - ` -h, --help ` - Show help message
41+
42+ ** Output format:**
43+
44+ The JSON output contains the following top-level keys:
45+
46+ - ` packs ` - Record of PackSpecification objects keyed by ID
47+ - ` variants ` - Record of LetterVariant objects keyed by ID
48+ - ` volumeGroups ` - Record of VolumeGroup objects keyed by ID
49+ - ` suppliers ` - Record of Supplier objects keyed by ID
50+ - ` allocations ` - Record of SupplierAllocation objects keyed by ID
51+ - ` supplierPacks ` - Record of SupplierPack objects keyed by ID
52+
53+ #### Generate Template
54+
55+ Generate a template Excel file with the correct sheet structure and column headers:
56+
57+ ``` bash
58+ # Generate a new template
59+ npm run template -- output.xlsx
60+
61+ # Overwrite existing template
62+ npm run template -- output.xlsx --force
63+
64+ # Show help
65+ npm run template -- --help
66+ ```
67+
68+ ** Options:**
69+
70+ - ` -f, --force ` - Overwrite existing file if it exists
71+ - ` -h, --help ` - Show help message
72+
73+ ** Generated sheets:**
74+
75+ The template includes the following sheets with proper column headers:
76+
77+ - ` PackSpecification ` - Pack specification definitions
78+ - ` LetterVariant ` - Letter variant configurations
79+ - ` VolumeGroup ` - Volume group definitions
80+ - ` Supplier ` - Supplier information
81+ - ` SupplierAllocation ` - Supplier allocation percentages
82+ - ` SupplierPack ` - Supplier-pack mappings
83+
84+ ### Programmatic Usage
85+
86+ #### Parsing an Excel file
1487
1588``` typescript
1689import { parseExcelFile } from " @nhs-notify/excel-parser" ;
0 commit comments