CSV Reader to edit CSV files

Associate
Joined
30 Mar 2004
Posts
1,148
Location
West Wing
Hi,

Im trying to design and code an application to read a .csv file and take data out and relocate into other csv files.

What currently happens is that each day I receive a CSV file containing around 10 rows, each row containing around 100 values with the first number in that row being a unique reference. I simply want to go through each row and copy that row into its own new .csv file. So each row will eventually have its own file.

I plan on programming this in C# so i understand theres already some handy tools in place for reading and writing CSV files. Can anyone point me in the right direction on how to do this?

Thanks!
 
Thanks Pho, that sort of worked.

To cut to the chase, here is a sample of the .csv files im working with. This one has 4 rows. I want to go through each row and copy that row to a new file.

Sample file
 
Thanks Eulogy. Although I know even less about using Powershell than I do with C#. I will also be including some FTP download and upload and file management functions around this part of the code. Im ok with these bits its just the part that processes the file that I need help with.

If I were to use the StreamReader class in C#, how do i make it read a set number of values before moving onto the next row. My rows will consistently be 101 values. All i can find now are ways of splitting rows by a comma or space which isnt much use.
 
Thanks for the assistance guys. Visibleman hit the nail on the head, it was simply a case of reading the file line by line and delimiting the values by ','. Amazing how quick it can process thousands of lines and append the line to a new file. :)
 
Back
Top Bottom