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
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