Add worksheet selection to excel-to-markdown skill

Add --sheet parameter to specify worksheets by name or index (1-based). Change default behavior to use first worksheet instead of active sheet, with proper error messages for invalid worksheet references.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Misaka Company
2026-01-29 10:10:57 +08:00
parent ae8642cdfe
commit cb8f57c12b
2 changed files with 53 additions and 9 deletions

View File

@@ -19,6 +19,18 @@ Convert an entire Excel file to Markdown:
python3 scripts/excel_to_markdown.py input.xlsx -o output.md
```
### Specify Worksheet
Convert a specific worksheet by name or index:
```bash
# By worksheet name
python3 scripts/excel_to_markdown.py input.xlsx -o output.md --sheet "Sheet2"
# By worksheet index (1-based)
python3 scripts/excel_to_markdown.py input.xlsx -o output.md --sheet 2
```
### Convert with Row/Column Numbers
Display Excel row and column identifiers for reference:
@@ -51,6 +63,7 @@ python3 scripts/excel_to_markdown.py input.xlsx -o output.md --start-row 2 --sta
| `--show-cols` | Display column letters (A, B, C...) in the first row |
| `--start-row` | Starting row number (default: 1) |
| `--start-col` | Starting column number (default: 1) |
| `--sheet` | Worksheet name or index (default: first worksheet) |
## Features
@@ -67,7 +80,12 @@ The converter automatically scans the spreadsheet to identify the actual data ra
### Multi-Sheet Support
By default, the converter processes the active (last selected) sheet in the workbook.
By default, the converter processes the first worksheet in the workbook. You can specify a different worksheet using the `--sheet` parameter:
- **By name**: `--sheet "Sheet2"` or `--sheet "Data"`
- **By index**: `--sheet 2` (1-based indexing)
If the specified worksheet is not found, an error will display the list of available worksheets.
## Common Use Cases