generate_csharp_script
Turn any existing .xlsx into a runnable C# script that rebuilds the same workbook, making file structure and formatting easy to inspect and modify.
Instructions
Reads an existing Excel workbook and returns a self-contained C# file (using Kookerella.CsOpenXmlDsl) that rebuilds an equivalent file when run via dotnet run <file>.cs (.NET 10's file-based apps feature - no .csproj needed). The C# equivalent of generate_fsharp_script, for a caller who wants pasteable/runnable C# rather than F# - useful for explaining how a file is structured, or as a starting point for the wrapper's fluent API (styling, tables, charts, pivot tables, sparklines, conditional formatting, data validation, hyperlinks, comments, print settings, defined names, protection, etc. - Kookerella.CsOpenXmlDsl now covers the same worksheet/workbook-level feature set as generate_fsharp_script's own Kookerella.FsOpenXmlDsl) beyond what create_workbook exposes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Path to an existing .xlsx/.xlsm file to reverse-engineer into C# source. | |
| outputFileName | Yes | The output filename the generated script should save its rebuilt file to, e.g. "output.xlsx". |