Troubleshooting
Template Errors
XML Parsing Failed
Symptom: failed to parse GXL XML error
Solutions:
- Validate XML syntax
- Check all tags are properly closed
- Ensure no special characters in attribute values
- Verify file encoding is UTF-8
Example:
<!-- Bad -->
<Sheet name="Sheet 1">
<!-- Good -->
<Sheet name="Sheet1">
</Sheet>
Invalid Grid Syntax
Symptom: Grid not rendering correctly
Solutions:
- Use
|as cell delimiter - Each row must start and end with
| - Consistent column count per row
Example:
<!-- Bad -->
<Grid>
Header1 | Header2
Value1 | Value2
</Grid>
<!-- Good -->
<Grid>
| Header1 | Header2 |
| Value1 | Value2 |
</Grid>
Anchor Reference Error
Symptom: invalid anchor ref error
Solutions:
- Use valid Excel cell references (A1, B2, etc.)
- Column letters must be uppercase
- Row numbers must be positive
Example:
<!-- Bad -->
<Anchor ref="a1" />
<!-- Good -->
<Anchor ref="A1" />
Data Errors
Data Not Displaying
Symptom: Template expressions show as empty or literal
Solutions:
- Verify JSON/YAML syntax
- Check data path matches template expression
- Ensure data file is loaded correctly
Example:
// data.json
{
"user": {
"name": "John"
}
}
<!-- Template -->
<Grid>
| Name |
| {{ .user.name }} |
</Grid>
Type Inference Issues
Symptom: Numbers displayed as text
Solutions:
- Use type hints:
{{ .value:number }} - Ensure numeric values in JSON are not quoted
- Check date format is ISO 8601
Example:
// Bad
{
"price": "100"
}
// Good
{
"price": 100
}
Loop Not Iterating
Symptom: <For> loop produces no output
Solutions:
- Verify data path points to an array
- Check loop syntax:
each="item in items" - Ensure array is not empty
Example:
{
"items": [
{"name": "Item 1"},
{"name": "Item 2"}
]
}
<For each="item in items">
<Grid>
| {{ .item.name }} |
</Grid>
</For>
Output Errors
Excel File Won't Open
Symptom: Generated .xlsx file is corrupted
Solutions:
- Check for write permissions
- Ensure output path exists
- Verify sufficient disk space
- Close Excel if file is already open
Missing Styles
Symptom: Bold/italic formatting not applied
Solutions:
- Use markdown syntax correctly:
**bold**,_italic_ - Ensure no extra spaces around markers
- Check GXL version supports styling
Example:
<!-- Bad -->
<Grid>
| ** bold ** |
</Grid>
<!-- Good -->
<Grid>
| **bold** |
</Grid>
Merged Cells Not Working
Symptom: <Merge> tag has no effect
Solutions:
- Use valid range:
A1:B2 - Ensure cells exist before merging
- Check for overlapping merge ranges
Performance Issues
Slow Generation
Symptom: Template takes long time to generate
Solutions:
- Reduce loop iterations if possible
- Simplify complex expressions
- Use batch operations where applicable
- Check system resources (CPU, memory)
Memory Errors
Symptom: Out of memory errors
Solutions:
- Process large datasets in chunks
- Reduce template complexity
- Increase available memory
- Optimize data structure
CLI Issues
Command Not Found
Symptom: goxcel: command not found
Solutions:
- Ensure goxcel is installed:
go install github.com/ryo-arima/goxcel/cmd/goxcel@latest - Check
$GOPATH/binis in$PATH - Verify installation:
which goxcel
Invalid Arguments
Symptom: CLI command fails
Solutions:
- Check required flags:
--template,--data,--output - Verify file paths are correct
- Use absolute paths if relative paths fail
- Check file permissions
Example:
# Full command with all flags
goxcel generate \
--template /path/to/template.gxl \
--data /path/to/data.json \
--output /path/to/output.xlsx
Logging and Debugging
Enable Debug Logging
Set log level in code:
logger := util.NewLogger(util.LoggerConfig{
Level: "DEBUG",
// ... other config
})
Check Log Messages
Look for message codes:
GXL-P1/P2: GXL parsingU-R1/R2: RenderingR-W1/W2: Writing
Common Error Codes
RP2: Failed to read GXL fileUR2: Failed to render templateRW2: Failed to write XLSX fileFSR2: Failed to read data file
Getting Help
If issues persist:
- Check GitHub issues: https://github.com/ryo-arima/goxcel/issues
- Review specification docs
- Create a minimal reproduction case
- Report bug with logs and sample files