Commit c716966
feat: Add comprehensive Excel support to nf-schema
Implements full Excel file processing functionality for nf-schema, addressing the need for
direct Excel workbook support without manual CSV conversion.
## Key Features
- **Full Excel Format Support**: XLSX, XLSM, XLSB, and XLS files using Apache POI 5.4.1
- **Sheet Selection**: Select specific sheets by name or index via options parameter
- **Data Type Preservation**: Proper handling of strings, numbers, booleans, dates, and formulas
- **Schema Integration**: Full compatibility with existing JSON schema validation pipeline
- **Backward Compatibility**: Zero impact on existing CSV/TSV/JSON/YAML functionality
## Implementation Details
### Core Components
- **WorkbookConverter.groovy**: Main Excel processing class with comprehensive error handling
- **Integration**: Seamless integration with SamplesheetConverter for transparent Excel processing
- **File Type Detection**: Enhanced file type detection in Files utility class
### Architecture
- **Clean Separation**: Excel processing handled in dedicated WorkbookConverter class
- **Configuration Integration**: Uses existing ValidationConfig for consistent error handling
- **Modular Design**: Separated header processing, row processing, and cell value extraction
### New Dependencies
- Apache POI 5.4.1 for Excel format support
- POI-OOXML for modern Excel formats (XLSX, XLSM)
- POI-Scratchpad for legacy Excel formats (XLS)
## Usage Examples
```nextflow
// Basic Excel usage - works just like CSV
params.input = "samplesheet.xlsx"
params.schema = "assets/schema_input.json"
include { samplesheetToList } from 'plugin/nf-schema'
workflow {
samplesheet = samplesheetToList(params.input, params.schema)
}
```
```nextflow
// Select specific sheet by name
samplesheet = samplesheetToList(params.input, params.schema, [sheet: "Sample_Data"])
// Select sheet by index (0-based)
samplesheet = samplesheetToList(params.input, params.schema, [sheet: 0])
```
## Testing
- WorkbookConverter unit tests with comprehensive error handling scenarios
- File type detection tests for all Excel formats
- Integration tests planned for full workflow validation
## Impact
- **User Experience**: Users can work directly with Excel files from data analysts/collaborators
- **Workflow Simplification**: Eliminates manual CSV conversion step
- **Data Fidelity**: Preserves original data types and formatting
- **Enterprise Ready**: Supports common Excel formats used in research/industry
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent a547e5c commit c716966
File tree
6 files changed
+580
-6
lines changed- scripts
- src
- main/groovy/nextflow/validation
- samplesheet
- utils
- test/groovy/nextflow/validation
6 files changed
+580
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
9 | 14 | | |
10 | 15 | | |
11 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
Lines changed: 24 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
99 | 122 | | |
100 | 123 | | |
101 | | - | |
102 | 124 | | |
103 | 125 | | |
104 | 126 | | |
| |||
107 | 129 | | |
108 | 130 | | |
109 | 131 | | |
110 | | - | |
111 | | - | |
| 132 | + | |
112 | 133 | | |
113 | 134 | | |
114 | 135 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
20 | 22 | | |
21 | 23 | | |
22 | 24 | | |
| |||
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
36 | 46 | | |
37 | 47 | | |
38 | 48 | | |
39 | | - | |
| 49 | + | |
40 | 50 | | |
41 | 51 | | |
42 | 52 | | |
| |||
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
49 | | - | |
| 59 | + | |
50 | 60 | | |
51 | 61 | | |
52 | 62 | | |
| |||
0 commit comments