this post was submitted on 28 Mar 2024
4 points (100.0% liked)

Programming

13375 readers
8 users here now

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

founded 1 year ago
MODERATORS
 

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
}
you are viewing a single comment's thread
view the rest of the comments
[–] EinfachUnersetzlich@lemm.ee 2 points 7 months ago (7 children)

What's the format of the text file?

[–] BobTheDestroyer@lemy.lol 1 points 7 months ago (1 children)

It's just a Notepad text file.

[–] giloronfoo@beehaw.org 1 points 7 months ago* (last edited 7 months ago) (1 children)

The confusion is that CSV is also just a Notepad text file that uses Commas to Separate Values.

They are asking about what kind of values are in it.

[–] BobTheDestroyer@lemy.lol 1 points 7 months ago

Just words? It's a list of names.

load more comments (5 replies)