Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Export-CSV avoid unnecessary quotations

$
0
0
Hi All,

I'm exporting a table from SQL DB using Export-CSV cmdlet.
There are various columns that may contain comma(,) in between.

When I export the table to CSV using Export-CSV command, the file appears as below:

"HostItemID","name2"
"4*.","Efg,Abc D"
"4*100000008","Xyz,Stu V"

But I want the CSV to be prepared as below:

HostItemID,name2
4*.,"Efg,Abc D"
4*100000008,"Xyz,Stu V"

I can't replace each '' with blank as it creates problem.
But I want to replace '' intelligently such that values with comma should be still enclosed in quotes.

Any help?

Regards,
Pavan



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>