Trouble with CSV file

Anthony K O365
Anthony K O365 used Ask the Experts™
on
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?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
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.
Top Expert 2010
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.
Anthony K O365Messaging Consulting

Author

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.
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

AkhaterSolutions Architect

Commented:
you don't need to use quotes in the csv even if the name has spaces
David CarrMessaging Administrator

Commented:
Are you using Import-CSV?
Anthony K O365Messaging Consulting

Author

Commented:
Yes
David CarrMessaging Administrator

Commented:
quotes are not needed in the CSV file.
Subash SundharanIT Infrastructure Architect

Commented:
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
Anthony K O365Messaging Consulting

Author

Commented:
Very good comments!

Thanks!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial