title: How to split CSV file into parts
body: <p>How can I split the csv files downloaded from the URL? I am trying to keep the header for the split.</p>
  
  <p>Example this</p>
  
  <pre><code>A,B,C,D,E
  1,2,3,4,5
  12,11,8,7,6
  23,23,34,1,0
  23,23,32,1,0
  </code></pre>
  
  <p>convert to </p>
  
  <pre><code>A,B,C,D,E
  1,2,3,4,5
  12,11,8,7,6
  
  A,B,C,D,E
  23,23,34,1,0
  23,23,32,1,0
  </code></pre>
  
  <p>I have this code below that retrieves the URL file:</p>
  
  <pre><code>MemoryStream file = GetStreamFromUrl(invoiceAPI);
  
  private static MemoryStream GetStreamFromUrl(string url)
  {
      MemoryStream stream = new MemoryStream();
  
      WebClient wc = new WebClient();
      using (MemoryStream streamDownload = new MemoryStream(wc.DownloadData(url)))
      {
         stream = streamDownload;
      }
  
      return stream;
  }
  </code></pre>
  
  <p>How can I be able to split the csv file and keep the header and also the files has a dynamic length can I be able to split it in only 10 rows for example because I will be uploading it for another set. Can you please show me how and explain. </p>