I have a script that duplicates a Word doc template and renames each using a csv file with a list of names. What would be the equivalent code if instead of a csv file I use a text file?

Import-csv ‘.\individuals2.csv’ | foreach-object {
	$newname = ‘2 ‘ + $_.name + '.docx’
	Copy-item '.\template.docx' $newname
}
  • Kissaki@beehaw.org
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    9 months ago

    A csv file is a text file. Where the data in text form is in a specific form.

    So your question doesn’t really make sense. You’re already using a text file, and you don’t disclose what would be different.

    • BobTheDestroyer@lemy.lolOP
      link
      fedilink
      arrow-up
      1
      ·
      9 months ago

      Oh I see. I thought only .txt files are text files.

      I was trying to adjust the code so that it uses a .txt file instead of a .csv file.