Easy question on using powershell for formatting text to import into excel

I don’t know much about powershell at all but I’m trying to make it easier to import a group of items into excel. I found the format I need but can’t seem to make the powershell script run how I want it to. This is what the text document looks like:

c1: one

c2: two

c3: three

the script I’m currently using is this:

(Import-CSv C:usersmikedesktoptest.txt -header c1,c2.c3 | Select c1,c2.c3) | Export-csv C:usersmikedesktoptest.txt -notypeinfo 

That turns my text into:

“c1″,”c2.c3”

“c1: one”,

“c2: two”,

“c3: three”,

I need it too look like this:

“c1″,”c2″,”c3”

“c1: one”,”c2: two”,”c3: three”

and eventually after adding more to the original text document:

“c1″,”c2″,”c3”

“c1: one”,”c2: two”,”c3: three”

“c1: four”,”c2: five”,”c3: six”

I’ll keep trying but any help is greatly appreciated.

submitted by /u/RealPapaJohns
[link] [comments]

Leave a Reply