I have an excel \[code\].csv\[/code\] file that has some data in the below formats in cells:\[code\]NAME Address ContactShoeb Lko 675567Rajesh Banaras 7687678\[/code\].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 fileI am trying to use C# to write another Excel \[code\].csv\[/code\] file in the same format.Code that I am using is written below:
\[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\]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?
\[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\]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?