FileTemplateApply[template]
applies a template, evaluating all template elements it contains, and then writes the result to a temporary file, whose name is returned.
FileTemplateApply[template,args]
applies a template, using args to fill its slots, and then writes the result to a temporary file.
FileTemplateApply[template,output]
applies a template, writing the results to the file represented by output.
FileTemplateApply[template,args,output]
applies a template, using args to fill its slots, and then writes the result to the file represented by output.


FileTemplateApply
FileTemplateApply[template]
applies a template, evaluating all template elements it contains, and then writes the result to a temporary file, whose name is returned.
FileTemplateApply[template,args]
applies a template, using args to fill its slots, and then writes the result to a temporary file.
FileTemplateApply[template,output]
applies a template, writing the results to the file represented by output.
FileTemplateApply[template,args,output]
applies a template, using args to fill its slots, and then writes the result to the file represented by output.
Details and Options

- FileTemplateApply operates on template and args just like TemplateApply.
- By default, FileTemplateApply will overwrite any existing content in output if it can.
- The output file can be specified as File["file"] or "file".
- FileTemplateApply takes the following options:
-
CombinerFunction Inherited function to apply to combine pieces before returning a result InsertionFunction Inherited function to apply before inserting expressions
Examples
open all close allBasic Examples (1)
FileTemplateApply works with any expression:
The first argument is handled by TemplateApply and can be a String, File, or any TemplateObject:
Specify a path to export the template in the specified location:
Scope (5)
File is fully supported:
File can also be used as a third argument, to specify the result:
Templates can be hosted in the Wolfram Cloud:
The result can be saved to a CloudObject:
URL can be used to fetch templates:
See Also
Related Guides
History
Text
Wolfram Research (2014), FileTemplateApply, Wolfram Language function, https://reference.wolfram.com/language/ref/FileTemplateApply.html.
CMS
Wolfram Language. 2014. "FileTemplateApply." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/FileTemplateApply.html.
APA
Wolfram Language. (2014). FileTemplateApply. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/FileTemplateApply.html
BibTeX
@misc{reference.wolfram_2025_filetemplateapply, author="Wolfram Research", title="{FileTemplateApply}", year="2014", howpublished="\url{https://reference.wolfram.com/language/ref/FileTemplateApply.html}", note=[Accessed: 13-August-2025]}
BibLaTeX
@online{reference.wolfram_2025_filetemplateapply, organization={Wolfram Research}, title={FileTemplateApply}, year={2014}, url={https://reference.wolfram.com/language/ref/FileTemplateApply.html}, note=[Accessed: 13-August-2025]}