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.
This topic is 5 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
apowershelluser
Posts: 194
Last visit: Mon Apr 15, 2024 3:21 pm
Answers: 2

CSV issues

Post by apowershelluser »

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
apowershelluser
Posts: 194
Last visit: Mon Apr 15, 2024 3:21 pm
Answers: 2

Re: CSV issues

Post by apowershelluser »

Sorry for posting in wrong board...
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: CSV issues

Post by jvierra »

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
apowershelluser
Posts: 194
Last visit: Mon Apr 15, 2024 3:21 pm
Answers: 2

Re: CSV issues

Post by apowershelluser »

Ha ha ha... badly imported.

That’s fine, I can figure out the rest.
This topic is 5 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked