Converting a .txt file to .csv file
-
Dear All, I need to convert a .txt file into a .csv file. How can I do this? Please help me. Thanx
-
Dear All, I need to convert a .txt file into a .csv file. How can I do this? Please help me. Thanx
That will depend on what is inside the .txt file. A txt file can contain anything whereas .csv file contains some kind of delimited data. But you could try to read the txt file using a StringReader and convert the data into csv as per your requirements and the save this to csv using StringWriter.
-
Dear All, I need to convert a .txt file into a .csv file. How can I do this? Please help me. Thanx
Mr Perfect wrote:
I need to convert a .txt file into a .csv file. How can I do this?
Change the file extension? Seriously - What format is the TXT file in?
Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
Mr Perfect wrote:
I need to convert a .txt file into a .csv file. How can I do this?
Change the file extension? Seriously - What format is the TXT file in?
Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
It contains some data seperated by delimiter.
-
It contains some data seperated by delimiter.
Mr Perfect wrote:
It contains some data seperated by delimiter.
That's a bit of a vague file format specification there. We are trying to be helpful, but you need to help us to help you. You need to give us the information about your problem so we can help you find a solution. What sort of delimiter? What will constitute one line in the resulting CSV file? Do you really just want to replace one delimiter for another?
Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
Mr Perfect wrote:
It contains some data seperated by delimiter.
That's a bit of a vague file format specification there. We are trying to be helpful, but you need to help us to help you. You need to give us the information about your problem so we can help you find a solution. What sort of delimiter? What will constitute one line in the resulting CSV file? Do you really just want to replace one delimiter for another?
Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
Delimiter may be a comma or semicolon or tab
-
Delimiter may be a comma or semicolon or tab
Read the entire file into a string. Use
Replace
to replace one delimiter with another. Save the new string to disk.
Upcoming events: * Glasgow: SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... * Reading: Developer Day 5 Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website