Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Trouble with CSV file

Posted on 2012-12-21
9
Medium Priority
?
1,164 Views
Last Modified: 2012-12-21
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?
0
Comment
Question by:Anthony K O365
9 Comments
 
LVL 6

Accepted Solution

by:
mo_patel earned 1000 total points
ID: 38713734
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
 
LVL 93

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 1000 total points
ID: 38713768
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
 

Author Comment

by:Anthony K O365
ID: 38713825
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
Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

 
LVL 49

Expert Comment

by:Akhater
ID: 38713870
you don't need to use quotes in the csv even if the name has spaces
0
 
LVL 9

Expert Comment

by:David Carr
ID: 38713903
Are you using Import-CSV?
0
 

Author Comment

by:Anthony K O365
ID: 38713910
Yes
0
 
LVL 9

Expert Comment

by:David Carr
ID: 38713964
quotes are not needed in the CSV file.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38713970
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
 

Author Closing Comment

by:Anthony K O365
ID: 38714548
Very good comments!

Thanks!
0

Featured Post

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
This video discusses moving either the default database or any database to a new volume.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question