CSV issues

Ask questions about creating Graphical User Interfaces (GUI) in PowerShell and using WinForms controls.
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Locked
User avatar
JohnTitor
Posts: 88
Joined: Fri Nov 17, 2017 8:49 pm

CSV issues

Post by JohnTitor » Wed Nov 21, 2018 5:15 pm

Hello, I'm trying to import a CSV from ServiceNow that consist of our incidents.
When I use import-csv C:\file.csv -header 'computername' it displays the first column
Which definitely ins't the computer, however if I do import-csv C:\file.csv | select-object -property 'computername'
It displays correct

Any ideas why?

User avatar
JohnTitor
Posts: 88
Joined: Fri Nov 17, 2017 8:49 pm

Re: CSV issues

Post by JohnTitor » Wed Nov 21, 2018 5:40 pm

Sorry for posting in wrong board...

User avatar
jvierra
Posts: 13128
Joined: Tue May 22, 2007 9:57 am
Contact:

Re: CSV issues

Post by jvierra » Wed Nov 21, 2018 5:53 pm

If a CSV has headers you don' need to specify headers. If you specify a header then the whole file will be badly imported.

User avatar
JohnTitor
Posts: 88
Joined: Fri Nov 17, 2017 8:49 pm

Re: CSV issues

Post by JohnTitor » Wed Nov 21, 2018 7:12 pm

Ha ha ha... badly imported.

That’s fine, I can figure out the rest.

Locked