goxcel is a template-based Excel file generator that uses GXL (Grid eXchange Language) format to define Excel workbook structures with data binding capabilities.
- Input: GXL (
.gxl) templates, JSON/YAML data files - Output: Excel (
.xlsx) files
goxcel is currently at version 0.1.1 (Stable) with v1.0 features implemented including grid layouts, loops, expressions, and markdown styling.
GXL templates are XML files with a .gxl extension. Basic structure:
<Book name="MyWorkbook">
<Sheet name="Sheet1">
<Grid>
| Header1 | Header2 |
| {{ .value1 }} | {{ .value2 }} |
</Grid>
</Sheet>
</Book>Yes, use the <For> tag:
<For each="item in items">
<Grid>
| {{ .item.name }} | {{ .item.value }} |
</Grid>
</For>Use markdown syntax or type hints:
**bold text**for bold_italic text_for italic{{ .value:number }}for type hints
JSON and YAML files are supported for data input.
Use dot notation: {{ .user.profile.name }}
Yes, mustache-style expressions {{ .path }} with automatic type inference.
goxcel generate --template template.gxl --data data.json --output output.xlsxYes, use the --dry-run flag:
goxcel generate --template template.gxl --data data.json --dry-runCheck:
- XML syntax is valid
- All tags are properly closed
- Grid syntax uses
|delimiters
Check:
- JSON/YAML data structure matches template paths
- Expression syntax is correct:
{{ .path }} - Data file is valid JSON/YAML
Ensure:
- Output path is writable
- No special characters in filename
- Sufficient disk space
goxcel can handle templates with thousands of rows. Performance depends on:
- Number of loops and iterations
- Complexity of expressions
- Available system memory
Yes, define multiple <Sheet> tags in your template.
Yes:
import "github.com/ryo-arima/goxcel/pkg/controller"
conf := config.NewBaseConfigWithFile("template.gxl")
ctrl := controller.NewCommonController(conf)
err := ctrl.Generate("template.gxl", "data.json", "output.xlsx", false)See the GitHub repository for contribution guidelines.