title: Remove invisible carriage return from CSV using javascript
body: <p>I try to parse a CSV in Google Apps Script (Google Sheets), with the code below:</p>
  
  <pre><code>var file = DriveApp.getFileById('xx');
  var blobasstr = file.getBlob().getDataAsString();
  var csvData = Utilities.parseCsv(blobasstr);
  </code></pre>
  
  <p>All works fine except from the fact that there are invisible carriage returns in my CSV within cells, which result in extra rows being created in the middle of cells.
  These carriage returns are a result from the fact that the source data contains cells with two address lines (and the carriage return in the middle). When I open the CSV in notepad I have to type my cursor twice to get past this point which strengthens my idea that there is a hidden carriage return there.</p>
  
  <p>Can I use a regex on my blobasstr that removes these invisible carriage returns, but of course keeps the usual carriage returns at the end of each line?</p>
  
  <hr>
  
  <p><strong>Edit:</strong> Thanks for referring to the earlier question. With the regex:</p>
  
  <pre><code>blobasstr.replace(/(?=["'])(?:"[^"\\]*(?:\\[\s\S][^"\\]*)*"|'[^'\\]\r\n(?:\\[\s\S][^'\\]\r\n)*')/g, '\\r\\n');
  </code></pre>
  
  <p>I am indeed able to remove the 'hidden' returns which is a great start. The thing is that I now end up with the text <strong>\r\n</strong> in the cells that had a invisible return (instead of the original content of the cell, this is probably caused by the replacement argument '\r\n' Is there an alternative for this that keeps the original content of the cell (of course without the hidden carriage return?) Thanks a lot!</p>
  
  <hr>
  
  <p>The help is really appreciated!</p>
  
  <p>Chris </p>