fill_template
Fill placeholders and merge fields in a Word doc with provided data, editing the existing file. Missing keys trigger error, skip, or empty fill; automatic backup protects your work.
Instructions
Fill a template IN PLACE: replace every {{name}} with data[name] (safe across fragmented runs, first run's formatting kept) and set MERGEFIELDs to their values as plain text. missing: 'error' refuses and changes nothing if the template needs a key data lacks; 'skip' leaves those markers; 'empty' fills them with empty strings. To produce filled COPIES instead of editing in place, use mail_merge. Auto-backup: prev/anchor slots in .ks4w-backups (backup=False skips rotation only); atomic validated save. Refuses documents open in Word.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | ||
| backup | No | ||
| missing | No | error | |
| file_path | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||