title: save as "proper" csv / delete quotes from CSV except for where comma exists
body: <p>I am downloading a CSV from a SharePoint site. It comes with a <code>.csv</code> file extension.</p>
  
  <p>When I inspect the file's contents by opening it in Notepad, I see data that looks like this sample row:</p>
  
  <p><code>"TITLE",OFFICE CODE,="","CUSTOMER'S NAME",ACCOUNT</code></p>
  
  <p>I want the data look like this:</p>
  
  <p><code>TITLE,OFFICE CODE,,"CUSTOMER'S NAME",ACCOUNT</code></p>
  
  <p>One way to solve this problem is manually. When I open the file in Excel and save it (without altering anything), it prompts me with the following: <code>fileOrig.csv may contain features that are not compatible with CSV (Comma delimited). Do you want to keep the workbook in this format?</code> When I save it, and then inspect it in Notepad, the data is formatted according to how I want it do look.</p>
  
  <p>Is there a quick way to resave the original CSV <strong>with PowerShell</strong>?</p>
  
  <p>If there is no quick way to resave the file <strong>with PowerShell</strong>, I would like to use PowerShell to parse it.</p>
  
  <p>These are the parsing rules I want to introduce:</p>
  
  <ul>
  <li>Remove encapsulating doublequote from cells that do not contain a <code>,</code> char</li>
  <li>Remove the <code>=</code> char</li>
  </ul>
  
  <p>I tried writing a test script that just looks at the column that potentially contains <code>,</code> chars. It is supposed to find the cells that do not contain a <code>,</code> char, and remove the doublequotes that encapsulate the text. It does not work, because I think it tosses the doublequote upon <code>Import-Csv</code></p>
  
  <pre><code>$source = 'I:\dir\fileOrig.csv'
  $dest = 'I:\dir\fileStaging.csv'
  $dest2 = 'I:\dir\fileFinal.csv'
  
  get-content $source |
      select -Skip 1 |
      set-content "$file-temp"
  move "$file-temp" $dest -Force
  
  $testcsv = Import-Csv $dest
  
  foreach($test in $testcsv)
  {
          #Write-Host $test."CUSTOMER NAME"  
  
          if($test."CUSTOMER NAME" -NotLike "*,*") {
              $test."CUSTOMER NAME" -replace '"', ''
          }
  }  
  
  $testcsv | Export-Csv -path $dest2 -Force
  </code></pre>
  
  <p>Can someone please help me either with implementing the logic above, or if you know of a better way to save the file as a proper CSV, can you please let me know?</p>