Use the -delimiter parameter specified in the online help for [export-csv][1] $DataSet.Tables[0] | Export-csv "G:\Text.txt" -NoTypeInformation -delimiter "|" [1]: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/export-csv?view=powershell-7.4&viewFallbackFrom=powershell-7