Adding double quotes to a specific column in a CSV

Welcome Forums General PowerShell Q&A Adding double quotes to a specific column in a CSV

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
3 months, 3 weeks ago.

  • Author
    Posts
  • #109865

    Participant
    Points: 0
    Rank: Member

    I am pulling some logs from Exchange and exporting them to a CSV using powershell and in the export I want to be able to put double quotes around one specific column that tends to have special characters or spaces in it. The column is MessageSubject. The reason I want to do this is because after doing the export there are times when I have a need to delete the messages from a users mailbox for purposes of spam and such. The way it works now is that there are no double quotes around the cells in the MessageSubject column and sometimes the delete fails because the script can't interpret the data in that column due to spaces or special characters.

  • #109898

    Participant
    Points: 319
    Helping Hand
    Rank: Contributor

    Just select the column, use RegEx to capture the string length in that column and  in you code add it

The topic ‘Adding double quotes to a specific column in a CSV’ is closed to new replies.