Trouble with CSV file

Here is what's happening: When I add quotes around the displaynames ("john smith") and save it as csv, when I open in notepad, it shows triple quotes around the names ("""john smith""") causing errors in my script. Some how the formatting is wrong when I save it. Even when I save it as a text file, it still shows triple quotation marks.

Any thoughts?
Anthony K O365Asked:
Who is Participating?
 
mo_patelConnect With a Mentor Commented:
this is the way excel works, you would have to write a macro to remove, or can you use tab delimited instead which will sort it.
0
 
Patrick MatthewsConnect With a Mentor Commented:
Exactly.  By using the quotations in the source data, you are making the quotes part of the source value.

When it's written to CSV, Excel wraps the field in two sets of double quotes to show that the original quotes are part of the text, and are not a text qualifier.

Perhaps you should take a step back and elaborate on what you are trying to accomplish.
0
 
Anthony K O365Author Commented:
I'm simply trying to import a csv into a powershell script. The csv is:

Name
"John Smith"
"Sue Jones"

Since the names contain spaces, I thought you needed to had either single or double quotes.
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
AkhaterCommented:
you don't need to use quotes in the csv even if the name has spaces
0
 
David CarrCommented:
Are you using Import-CSV?
0
 
Anthony K O365Author Commented:
Yes
0
 
David CarrCommented:
quotes are not needed in the CSV file.
0
 
SubsunCommented:
Are you adding this quotes manually? if yes it's not necessary. See the MS article for details.
Ref : http://technet.microsoft.com/en-us/library/ee176874.aspx

Attached sample CSV, when you run Import-CSV it should list as shown in the screenshot..
Import-CSVTest.CSV
0
 
Anthony K O365Author Commented:
Very good comments!

Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.