Map columns
When your CSV/JSON headers don't match template control names, use columns mapping in lakreet.config.json.
The problem
Template controls: Source Text, Opacity Your CSV headers: Nama, Ketebalan
csv
Nama,Ketebalan
Budi,100
Sari,60Solution: column mapping
Create lakreet.config.json:
json
{
"columns": {
"Nama": "Source Text",
"Ketebalan": "Opacity"
}
}Now lakreet-swarm maps Nama → Source Text, Ketebalan → Opacity automatically.
How it works
- Read CSV header:
Nama - Look up in
columns: found →Source Text - Validate against template control:
Source Textexists ✓ - Coerce value for
Source Text(text type)
Priority order
Column resolution follows this precedence:
- CLI flag
--data(file path) - Config file
lakreet.config.json→columns - Environment — not applicable for columns
- Default — header name used as-is
In JSON/JSONL
Same mapping applies — object keys are treated like CSV headers:
json
{ "Nama": "Budi", "Ketebalan": 100 }Mapped to Source Text, Opacity via config.
Multiple headers to one control
Not supported. One CSV header → one control. If you need merging, preprocess your data.
Validation
Unmapped headers that don't match any control = error:
Column "Unknown" is not a control of the template. Available: Source Text, OpacityMapped headers that don't exist in CSV = silently ignored (no error).
Example: Indonesian Excel export
json
// lakreet.config.json
{
"template": "template.ectemplate",
"data": "data.csv",
"delimiter": ";",
"columns": {
"Nama Lengkap": "Source Text",
"Tingkat Ketebalan": "Opacity",
"Aktif": "Visible"
}
}Next steps
- Prepare a CSV — delimiter, BOM, quoting
- Configuration reference — all config keys
- Validate first — catch mapping errors early