Powershell: Create multiple files from a Word template and rename using a list in Excel/CSV

https://lemy.lol/post/22074916

Powershell: Create multiple files from a Word template and rename using a list in Excel/CSV - lemy.lol

I’m a beginner to Powershell and CLI in general, but this task does not need to use either so I’m open to using other tools. I’m trying to do the following: 1. Create multiple files from a Word template. 2. Rename each file based on a list of names found in an Excel/CSV sheet. Thanks in advance!

You should be able to use COM interoperability , specifically the OpenAsDocument() and Save() methods. You can also use COM interoperability to read from Excel, but using ImprtFrom-CSV would be much easier. Then you just iterate over the file names, and for each one open the template as a document, then save it as the filename.
Template Interface (Microsoft.Office.Interop.Word)

Represents a document template.

Sorry I’m new to this. What exactly do I enter into Powershell for each step?