Solved

Trouble with CSV file

Posted on 2012-12-21
9
1,087 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:kt KTAdmin
9 Comments
 
LVL 6

Accepted Solution

by:
mo_patel earned 250 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 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 250 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:kt KTAdmin
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
 
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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 9

Expert Comment

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

Author Comment

by:kt KTAdmin
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:kt KTAdmin
ID: 38714548
Very good comments!

Thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

746 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now