Write .csv file(Excel type File) data to .csv file(Excel type File) in c#
<p>I have an excel <code>.csv</code> file that has some data in the below formats in cells:</p>

<pre><code>NAME Address Contact
Shoeb   Lko 675567
Rajesh  Banaras 7687678
</code></pre>

<p>.csv file is not a text file having only .csv extension. It is a csv file that is made using Microsoft Excel file...For testing you can also make .csv file... For this (1) create an excel file (2) open this excel file (3) go to file menu and click on "save as" (4) select CSV(Comma Seperated) option in Save as type:    ---- Now this is .csv file from which I will read content and write content also in a .csv file</p>

<p>I am trying to use C# to write another Excel <code>.csv</code> file in the same format.</p>

<p><em><strong>Code that I am using is written below:<br /></em></strong></p>

<pre><code>//Below line is reading file from system drive
    StreamReader rd = new StreamReader("D:\FilesUploadedToTablet\drivers.csv", true);
//Below line is writing data to file existing in our site folder
    StreamWriter wr = new StreamWriter(Server.MapPath(".") + "\filename\CSVFile.csv");
    wr.Write(rd.ReadToEnd());
    rd.Close();
    wr.Close();
</code></pre>

<p>Here <code>StreamReader</code> is reading <code>drivers.csv</code> file but <code>StreamWriter</code> is not writing that content to the <code>CSVFile.csv</code> file. If I use any text file in place of .csv file then the content writes successfully. What am I doing wrong?</p>
