FileTemplate
✖
FileTemplate
yields a TemplateObject expression that represents a file template to be applied using functions like TemplateApply.
uses File[…], URL[…], or CloudObject[…] as the specification for the file location.
yields a TemplateObject with arguments, suitable for cloud deployment or other evaluation.
Details and Options

- FileTemplate will infer from the extension whether to interpret the contents as a StringTemplate, XMLTemplate, or NotebookTemplate.
- FileTemplate[CloudObject[…]] will infer the template type based on the contents of the cloud object.
- FileTemplate[File["path"]] and FileTemplate["path"] are effectively equivalent.
- The following special forms can be used in the file for FileTemplate:
-
`` TemplateSlot[] `n` TemplateSlot[n] `name` TemplateSlot["name"] <*expr*> TemplateExpression[expr] - FileTemplate has the following options:
-
CombinerFunction Automatic function to apply to combine pieces before returning a result InsertionFunction Automatic function to apply before inserting expressions Path $TemplatePath search for templates on the specified path
Examples
open allclose allBasic Examples (1)Summary of the most common use cases
Loading a template file from disk:

https://wolfram.com/xid/0b8cw8waea-qf4tcj

Applying to a FileTemplate:

https://wolfram.com/xid/0b8cw8waea-j5xpp2


https://wolfram.com/xid/0b8cw8waea-1insba

The type of template to use is by default determined by the extension:

https://wolfram.com/xid/0b8cw8waea-3jstzd

Evaluate $TemplatePath to see where FileTemplate is searching for templates:

https://wolfram.com/xid/0b8cw8waea-sx4281

Scope (3)Survey of the scope of standard use cases
File is fully supported:

https://wolfram.com/xid/0b8cw8waea-f48c8p

Templates can be hosted in the Wolfram Cloud:

https://wolfram.com/xid/0b8cw8waea-zn99tp


https://wolfram.com/xid/0b8cw8waea-binn8z

URL can be used to fetch templates:

https://wolfram.com/xid/0b8cw8waea-ehr44g


https://wolfram.com/xid/0b8cw8waea-uwsajo


https://wolfram.com/xid/0b8cw8waea-se9tn7

URL can be directly used by TemplateApply:

https://wolfram.com/xid/0b8cw8waea-6etf82

Options (2)Common values & functionality for each option
InsertionFunction (1)
Specify a function to convert arguments before they are inserted:

https://wolfram.com/xid/0b8cw8waea-xldpc6


https://wolfram.com/xid/0b8cw8waea-dnzkqo

You can use a string to specify an export format:

https://wolfram.com/xid/0b8cw8waea-p2w19u

Properties & Relations (1)Properties of the function, and connections to other functions
If you deploy a template with data, each time you visit it TemplateApply will render the content again:

https://wolfram.com/xid/0b8cw8waea-kwsq8a

Wolfram Research (2014), FileTemplate, Wolfram Language function, https://reference.wolfram.com/language/ref/FileTemplate.html.
Text
Wolfram Research (2014), FileTemplate, Wolfram Language function, https://reference.wolfram.com/language/ref/FileTemplate.html.
Wolfram Research (2014), FileTemplate, Wolfram Language function, https://reference.wolfram.com/language/ref/FileTemplate.html.
CMS
Wolfram Language. 2014. "FileTemplate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FileTemplate.html.
Wolfram Language. 2014. "FileTemplate." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FileTemplate.html.
APA
Wolfram Language. (2014). FileTemplate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FileTemplate.html
Wolfram Language. (2014). FileTemplate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FileTemplate.html
BibTeX
@misc{reference.wolfram_2025_filetemplate, author="Wolfram Research", title="{FileTemplate}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/FileTemplate.html}", note=[Accessed: 29-March-2025
]}
BibLaTeX
@online{reference.wolfram_2025_filetemplate, organization={Wolfram Research}, title={FileTemplate}, year={2014}, url={https://reference.wolfram.com/language/ref/FileTemplate.html}, note=[Accessed: 29-March-2025
]}